Galil DMC-3425 Home Security System User Manual


 
DMC-3425 Chapter 7 Application Programming 125
Example - Input Interrupt
This simple program jogs the A and C motors (C motor is the first motor of the first slave controller of
a distributed control system). When the first input of the master (input 1), goes low, the controller will
stop motion on both axes. When the input returns high, the motors will resume jogging.
Instruction
Interpretation
#A Label
II1 Input Interrupt on 1
JG 30000,,60000 Jog
BGAD Begin Motion
#LOOP;JP#LOOP;EN Loop
#ININT Input Interrupt
STAD;AMAD Stop Motion
#TEST;JP #TEST, @IN[1]=0 Test for Input 1 still low
JG 30000,,,6000 Restore Velocities
BGAD Begin motion
RI0
Return from interrupt routine to Main Program and do not
re-enable trippoints
Example - Motion Complete Timeout
This simple program will issue the message “A fell short” if the A axis does not reach the commanded
position within 1 second of the end of the profiled move.
Instruction
Interpretation
#BEGIN Begin main program
TW 1000 Set the time out to 1000 ms
PA 10000 Position Absolute command
BGA Begin motion
MCA Motion Complete trip point
EN End main program
#MCTIME Motion Complete Subroutine
MG “A fell short” Send out a message
EN End subroutine
Example - Command Error
The above program prompts the operator to enter a jog speed. If the operator enters a number out of
range (greater than 8 million), the #CMDERR routine will be executed prompting the operator to enter
a new number.
In multitasking applications, there is an alternate method for handling command errors from different
threads. Using the XQ command along with the special operands described below allows the
controller to either skip or retry invalid commands.
Instruction
Interpretation
#BEGIN Begin main program
IN "ENTER SPEED", SPEED Prompt for speed
JG SPEED;BGA; Begin motion
JP #BEGIN Repeat