DMC-40x0 Command Reference
#LIMSWI • 151
#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:
State of Forward limit switch
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
Summary of Contents for DMC-40x0 Series
Page 2: ......
Page 4: ......
Page 10: ...vi i Table of Contents DMC 40x0 Command Reference This Page is Left Blank Intentionally ...