11ć14, 4 return instruction – Rockwell Automation 1772-LP3 PLC - 2/30 Programmable Controller Programming and Operations Manual User Manual
Page 215
Jump Instructions and
Subroutine Programming
Chapter 11
11Ć14
The Return instruction is an output instruction (Figure 11.11). It is used
only in the subroutine area to terminate a subroutine and to return program
execution to the main program (Figure 11.8) or, in the case of nested
subroutines, to return program execution to the preceding subroutine
(Figure 11.11). It returns program execution to the instruction immediately
following the JSR that initiated the subroutine. Program execution
continues from that point.
CAUTION: Every subroutine must have a Return instruction.
If not, the processor will scan the subsequent subroutine(s) until
a Return instruction is found. For this reason, it is recommended
that Return instructions be programmed unconditionally.
The return instruction does not have a user-assigned identification number
because it may be paired by the processor with any one of several JSR
instructions as the result of multiple jumps to the subroutine area. This is
illustrated by Figure 11.3.
Instruction overview:
Output instruction
Every subroutine must have a return instruction.
Should be used in an unconditional rung.
Processor is returned to the instruction after the JSR that initiated the
subroutine
Uses 1 word of memory.
Does not have a 2-digit identification number
Causes of run-time errors:
NOTE: Do not misuse the Return instruction. Misuse generally results in
a run-time error which causes the processor to fault. Misuse will cause the
following run-time errors:
Processor finds no return from the subroutine area.
Using a return instruction outside the subroutine area
Figure 11.11
RETURN Format
( RET )
11.4
Return Instruction