Several years ago, we added this subroutine to our machine to prevent crashes.
$O.SSB
OALM
N1 IF[[VDIN[1128] AND 2] EQ 2] NEND(MACHINE LOCK)
N2 IF[[VDIN[1138] AND 32] EQ 32] NALA7 (LOAD AUTO SET)
N3 IF[[VDIN[1128] AND 1] EQ 1] NALA1 (DRY RUN ON)
N4 IF[[VDIN[1128] AND 128] EQ 128] NEND (SINGLE BLOCK ON)
N5 IF[[VDIN[1132] AND 2] EQ 2] NALA2 (FEED RATE OVER)
N6 IF[[VDIN[1132] AND 8] NE 8] NALA2 (FEED RATE OVER)
N7 IF[[VDIN[1132] AND 1] EQ 1] NALA2 (FEED RATE OVER)
N8 IF[[VDIN[1132] AND 4] EQ 4] NALA2 (FEED RATE OVER)
N9 IF[[VDIN[1132] AND 16] NE 16] NALA3 (SPINDLE OVER)
N10IF[[VDIN[1132] AND 32] EQ 32] NALA3 (SPINDLE OVER)
N11IF[[VDIN[1132] AND 64] NE 64] NALA3 (SPINDLE OVER)
N12IF[[VDIN[1132] AND 128] EQ 128] NALA3 (SPINDLE OVER)
N13IF[[VDIN[1126] AND 128] NE 128] NALA5 (AUTO COOLANT)
GOTO NEND
NALA1 VUACM[1]='DRY RUN IS ON'
VDOUT[993]=1000
NALA2 VUACM[1]='FEED RATE NE 100'
VDOUT[993]=1000
NALA3 VUACM[1]='SPINDLE OVERRIDE'
VDOUT[993]=1000
NALA4 VUACM[1]='LOAD MONITOR'
VDOUT[993]=1000
NALA5 VUACM[1]='COOLANT NOT ON'
VDOUT[993]=1000
NALA7 VUACM[1]='LOAD AUTO SET'
VDOUT[993]=1000
NEND RTS
%
Now we need to add a line to check to make sure the tailstock is retracted. I know the variable I need is VDIN[1168], just not sure what to set the EQ to, nor do I fully understand the AND part of the equation. If it helps, the machine is an LC-20 4-Axis Simulturn. Any help on this would be greatly appreciated.