- After interrupt subprogram (SUB() in this case) is completed, you need to use RESUME instruction to send program pointer back to main routine where interrupt was declared. So declare three levels of Programs with no motion with interrupt checking in first level:
- first level where you declared the interrupt,
- second level where you should move from P1 to P2 (where you need monitor interrupt)
- third SUB (), saving position and vacuum on
- Use Brake or BrakeF command to stop the robot
- Stop the advance run in SUB()
e.g.
DEF INTERRUPT()
GLOBAL INTERRUPT DECL 20 WHEN $IN[1]==TRUE DO SUB()
PRODUCTION()
END
__________________
DEF PRODUCTION()
PTP APPROCH_POS
PTP P1
INTERRUPT ON 20
PTP P2
INTERRUPT OFF 20
END
__________________
DEF SUB()
BRAKE ;Stop the robot
INTERRUPT OFF 20
XP1.Z = $POS_ACT.Z -100
LIN XP1
Vaccum_ON()
WAIT SEC 0 ;to stop advance run
RESUME
END
__________________