Galil Motion Control manc 18x 6 Page 135
DMC-18x6 Command Reference
127
#LIMSWI
FUNCTION: Limit switch automatic subroutine
DESCRIPTION:
Without #LIMSWI defined, the controller will effectively issue the STn on the axis when it's limit
switch is tripped. With #LIMSWI defined, the axis is still stopped, and in addition, code is
executed. #LIMSWI is most commonly used to turn the motor off when a limit switch is
tripped (see example below). For #LIMSWI to run, the switch corresponding to the direction
of motion must be tripped (forward limit switch for positive motion and negative limit switch
for negative motion). #LIMSWI interrupts thread 0 when it runs.
USAGE:
While Moving
Yes
In a Program
Yes
Command Line
No
Controller Usage
ALL
RELATED COMMANDS:
_LFX
State of forward limit switch
_LRX
State of reverse limit switch
EXAMPLES:
#Main
;
'print a message every second
MG
"Main"
WT
1000
JP
#Main
EN
#LIMSWI
;
'runs when a limit switch is tripped
IF
(_LFX = 0) | (_LRX = 0)
MG
"X"
DC
X
=67107840
ST
X
AM
X
MO
X
ELSE
;
IF
(_LFY = 0) | (_LRY = 0)
MG
"Y"
DC
Y
=67107840
ST
Y
AM
Y
MO
Y
ENDIF
;
ENDIF
RE
1
NOTE: The automatic subroutine runs in thread 0.
NOTE: Use RE to end the routine