omron — RETURN program instruction

RETURN program instruction RETURN program instruction Syntax RETURN Function Terminate execution of the current subroutine, and resume execution of the suspended program at its next step. A program may have been suspended by issuing a CALL, CALLP, or CALLS instruction, or by the triggering of a REACT, REACTE, or REACTI condition. Details A RETURN instruction in a main program has the same effect as a STOP instruction. A RETURN instruction is assumed if program execution reaches the last step of a subroutine. However, it is not good programming style to use this feature-an explicit RETURN instruction should be included as the last line of each subroutine.

The effect of a RETURN instruction in an error reaction subroutine differs slightly. In that case, if the reaction subroutine was invoked because of a program error (as opposed to an asynchronous servo error or PANIC button press), the statement that caused the error is executed again. That is, the error may occur again immediately. The RETURNE instruction should be used in error reaction subroutines to avoid that situation. If a RETURN instruction is used to exit from a reaction routine, the program reaction priority is restored to whatever it was before the reaction routine started execution.

Related Keywords CALL program instruction CALLP program instruction CALLS program instruction LOCK program instruction REACT program instruction REACTE program instruction REACTI program instruction RETURNE program instruction eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 436