Galil DMC-13X8 Home Theater Server User Manual


 
Chapter 7 Application Programming 140 USER MANUAL
JP #A,@IN[1]=0 Jump to A if input 1 is low
JP #B,@IN[2]=1 Jump to B if input 2 is high
AI 7 Wait until input 7 is high
AI -6 Wait until input 6 is low
Example - Start Motion on Switch
Motor X must turn at 4000 counts/sec when the user flips a panel switch to on. When panel switch is
turned to off position, motor X must stop turning.
Solution: Connect panel switch to input 1 of DMC-13X8. High on input 1 means switch is in on
position.
INSTRUCTION FUNCTION
#S;JG 4000 Set speed
AI 1;BGX Begin after input 1 goes high
AI -1;STX Stop after input 1 goes low
AMX;JP #S After motion, repeat
EN;
Input Interrupt Function
The DMC-13X8 provides an input interrupt function which causes the program to automatically
execute the instructions following the #ININT label. This function is enabled using the II m,n,o
command. The m specifies the beginning input and n specifies the final input in the range. The
parameter o is an interrupt mask. If m and n are unused, o contains a number with the mask. A 1
designates that input to be enabled for an interrupt, where 2
0
is bit 1, 2
1
is bit 2 and so on. For
example, II,,5 enables inputs 1 and 3 (2
0
+ 2
2
= 5).
A low input on any of the specified inputs will cause automatic execution of the #ININT subroutine.
The Return from Interrupt (RI) command is used to return from this subroutine to the place in the
program where the interrupt had occurred. If it is desired to return to somewhere else in the program
after the execution of the #ININT subroutine, the Zero Stack (ZS) command is used followed by
unconditional jump statements.
IMPORTANT: Use the RI instruction (not EN) to return from the #ININT subroutine.
Examples - Input Interrupt
#A Label #A
II 1 Enable input 1 for interrupt function
JG 30000,-20000 Set speeds on X and Y axes
BG XY Begin motion on X and Y axes
#B Label #B
TP XY Report X and Y axes positions
WT 1000 Wait 1000 milliseconds
JP #B Jump to #B
EN End of program
#ININT Interrupt subroutine
MG "Interrupt has
occurred"
Displays the message
ST XY Stops motion on X and Y axes