I am controlling a laser from an IRC5 for a welding application. The laser requires a complex handshake for both startup and shutdown, which I handle with two dedicated routines. In automatic mode, things run beautifully… the startup routine establishes control of the laser, sets parameters, and starts gas flows; smaller subroutines coordinate laser firing with robot motion; and the shutdown routine gracefully terminates laser operations at the end.
The problem is handling laser safety during unanticipated program flows such as manual (non-automatic-mode) operation with an operator who may release the enabling device early, or such as an error condition arising during program operation. Laser firing is handled by a signal that requires EN1, EN2, ES1, ES2, etc. to also be engaged, so that the laser will not fire if something goes amiss. What I cannot figure out is how to also tie in the startup and shutdown routines so that they will execute to completion as the enable loop is opened and closed. A break in EN1, for instance, should also execute the shutdown routine, which includes a series of SetDO and WaitDI statements, even when the main program execution has stopped due to the break in EN1. I believe TRAP will stop execution if the enable loop is open, correct?
Any guidance is appreciated!