Galil Motion Control optcom Page 135
Optima DMC-1xxx and DMC-18x2 Command Reference
#LIMSWI
i
124
#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, code must be running in
thread 0 AND 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"
WT1000
JP#Main
EN
#LIMSWI ;'runs when a limit switch is tripped
IF (_LFX = 0) | (_LRX = 0)
MG "X"
DCX=67107840
STX
AMX
MOX
ELSE; IF (_LFY = 0) | (_LRY = 0)
MG "Y"
DCY=67107840
STY
AMY
MOY
ENDIF; ENDIF
RE1
NOTE: An application program must be executing for the automatic subroutine to function, which
runs in thread 0.
NOTE: Use RE to end the routine