Limit Switch Routine
The DMC-40x0 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. X,Y,Z, or W following LR or LF
specifies the axis. The CN command can be used to configure the polarity of the limit switches.
Limit Switch Example:
#A;JP #A;EN Dummy Program
#LIMSWI Limit Switch Utility
V1=_LFX Check if forward limit
V2=_LRX 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;AMX Stop motion
PR-1000;BGX;AMX Move in reverse
JP#END End
#LR #LR
MG “REVERSE LIMIT”
Send message
STX;AMX Stop motion
PR1000;BGX;AMX Move forward
#END End
RE Return to main program
DMC-40x0 User Manual Chapter 8 Hardware & Software Protection • 180