Galil Motion Control DMC-21 5 Series User Manual page 98

Table of Contents

Advertisement

Example - Communication Interrupt
A DMC-2115 is used to move the A axis back and forth from 0 to 10000. This motion can be paused, resumed and
stopped via input from the serial port.
#main;
CI
2;
MG
{P1}"Type 0 to stop
motion";
MG
{P1}"Type 1 to pause
motion";
MG
{P1}"Type 2 to resume
motion";
rate=2000;
SPA=rate;
SH
A;
#loop;
PAA=10000;
BG
A;
AM
A;
PAA=0;
BG
A;
AM
A;
JP
#loop;
EN;
#COMINT;
JP
#stop,(P1CH="0");
JP
#pause,(P1CH="1");
JP
#resume,(P1CH="2");
EN
1,1;
#stop;
ST
A;
ZS;
EN;
#pause;
rate=_SPA;
SPA=0;
EN
1,1;
#resume;
SPA=rate;
EN
1,1;
For additional information, see section on Using Communication Interrupt .
JS Subroutine Stack Variables (^a, ^b, ^c, ^d, ^e, ^f, ^g, ^h)
There are 8 variables that may be passed on the subroutine stack when using the JS command. Passing values on
the stack is advanced DMC programming, and is recommended for experienced DMC programmers familiar with
the concept of passing arguments by value and by reference.
1. Passing parameters has no type checking, so it is important to exercise good programming style when
passing parameters. See examples below for recommended syntax.
2. Do not use spaces in expressions containing ^.
3. Global variables MUST be assigned prior to any use in subroutines where variables are passed by
reference.
Chapter 7 Application Programming ▫ 93
'label for main of program
'setup communication interrupt for serial port
'send message to serial port
'send message to serial port
'send message to serial port
'variable to remember speed
'set speed of a axis motion
'enable A axis
'label for loop
'move to absolute position 10000
'begin motion on a axis
'wait for motion to be complete
'move to absolute position 0
'begin motion on a axis
'wait for motion to be complete
'continually loop to make back and forth motion
'end main program
'interrupt routine
'check for s (stop motion)
'check for p (pause motion)
'check for r (resume motion)
'do nothing
'routine for stopping motion
'stop motion
'zero program stack
'end program
'routine for pausing motion
'save current speed setting of a axis motion
'set speed of a axis to zero (allows for pause)
're-enable trippoint and communication interrupt
'routine for resuming motion
'set speed on a axis to original speed
're-enable trippoint and communication interrupt
DMC-21x5 User Manual 1.0a1

Advertisement

Table of Contents
loading

Table of Contents