Limit switch routine, Example – Galil DMC-2X00 User Manual
Page 184

SHA
Servo motor here to clear error
RE
Return to main program
NOTE: An applications program must be executing for the #POSERR routine to function.
Limit Switch Routine
The DMC-2x00 provides forward and reverse limit switches which inhibit motion in the respective
direction. There is also a special label for automatic execution of a limit switch subroutine. The
#LIMSWI label specifies the start of the limit switch subroutine. This label causes the statements
following to be automatically executed if any limit switch is activated and that axis motor is moving in
that direction. The RE command ends the subroutine.
The state of the forward and reverse limit switches may also be tested during the jump-on-condition
statement. The _LR condition specifies the reverse limit and _LF specifies the forward limit. A,B,C,
or D following LR or LF specifies the axis. The CN command can be used to configure the polarity of
the limit switches.
Example
Instruction Interpretation
#A;JP #A;EN
Dummy Program
#LIMSWI
Limit Switch Utility
v1=_LFA
Check if forward limit
v2=_LRA
Check if reverse limit
JP#LF,v1=0
Jump to #LF if forward
JP#LR,v2=0
Jump to #LR if reverse
JP#END
Jump to end
#LF #LF
MG "FORWARD LIMIT"
Send message
STX;AMA Stop
motion
PR-1000;BGA;AMA
Move in reverse
JP#END End
#LR #LR
MG "REVERSE LIMIT"
Send message
STX;AMA Stop
motion
PR1000;BGA;AMA Move
forward
#END End
RE
Return to main program
NOTE: An applications program must be executing for #LIMSWI to function.
174
• Chapter 8 Hardware & Software Protection
DMC-2X00