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

Table of Contents

Advertisement

The
#COMINT
label is used for the communication interrupt. For example, the DMC-21x5 can be configured to
interrupt on any character received on Port 2. The
and the subroutine can decode the characters. At the end of the routine the
enable the interrupt and return to the line of the program where the interrupt was called,
line of the program where it was called without re-enabling the interrupt. As with any automatic subroutine, a
program must be running in thread 0 at all times for it to be enabled.
Example
A DMC-21x5 is used to jog the A and B axis. This program automatically begins upon power-up and allows the user
to input values from the main serial port terminal. The speed of either axis may be changed during motion by
specifying the axis letter followed by the new speed value. An S stops motion on both axes.
#AUTO;
speedA=10000;
speedB=10000;
CI
2;
JG speedA,
speedB;
SH
AB;
BG
AB;
#print;
MG{P2}"TO CHANGE
MG{P2}"TYPE A OR
MG{P2}"TYPE S TO
#jogloop;
JG speedA,
speedB;
WT
50;
JP
#jogloop;
EN;
#COMINT;
JP
#a,(P2CH="A");
JP
#b,(P2CH="B");
JP
#s,(P2CH="S");
ZS 1;CI
2;JP
#jogloop;
#a;JS
#num;
speedA=val;
ZS 1;CI
2;JP#print;
#b;JS#num;
speedB=val;
ZS 1;CI
2;JP#print;
#s;ST AB;AM
AB;CI-1;
MG{^8},
"THE
END";
ZS;EN,1;
#num;
MG
"ENTER",P2CH{S},"AXIS
SPEED"
{N};
#numloop; CI-1;
#nmlp;
JP
#nmlp,(P2CD<2);
JP
#error,(P2CD=2);
val=P2NM;
EN;
#error;CI-1;
MG
"INVALID, TRY
JP
#nmlp;
EN;
Chapter 7 Application Programming ▫ 104
#COMINT
'label to automatically execute
'initial A axis speed
'initial B axis speed
'set Port 2 for Character Interrupt
'specify jog mode speed for A and B axes
'enable A and B axes
'begin motion
'label for routine to print to terminal;
SPEEDS";
B";
STOP";
'label for loop to change jog speeds
'set new jog speed
'jump to loop label
'end of main program
'interrupt routine
'check for A
'check for B
'check for S
'jump back if not A,B, or S
'new A axis speed
'jump to print
'new B axis speed
'jump to print
'stop motion
'end routine, reenable interrupt
'routine for entering new jog speed
'prompt for value
'check for enter
'routine to check input from terminal
'jump to error if string
'end subroutine
'error Routine
AGAIN";
'error message
'jump to loop for new value
'end
subroutine is entered when a character is received
EN
command is used.
EN,1
will re-
will just return to the
EN
DMC-21x5 User Manual 1.0a1

Advertisement

Table of Contents
loading

Table of Contents