Using Sbr; Using Ret - Allen-Bradley SLC 500 Series Reference Manual

Hide thumbs Also See for SLC 500 Series:
Table of Contents
You must program each subroutine in its own program file by assigning a
unique file number (3 to 255)
Fixed and SLC 5/01 specific - The JSR instruction
IMPORTANT
cannot be programmed in nested output branches. A
compiler error will occur if a rung containing
multiple outputs with conditional logic and a JSR
instruction is encountered.

Using SBR

The target subroutine is identified by the file number that you entered in the
JSR instruction. This instruction serves as a label or identifier for a program
file as a regular subroutine file.
This instruction has no control bits. It is always evaluated as true. The
instruction must be programmed as the first instruction of the first rung of a
subroutine. Use of this instruction is optional; however, we recommend using
it for clarity.

Using RET

This output instruction marks the end of subroutine execution or the end of
the subroutine file. It causes the controller to resume execution at the
instruction following the JSR instruction. If a sequence of nested subroutines
is involved, the instruction causes the processor to return program execution
to the previous subroutine.
The rung containing the RET instruction may be conditional if this rung
precedes the end of the subroutine. In this way, the controller omits the
balance of a subroutine only if its rung condition is true.
Without an RET instruction, the END instruction (always present in the
subroutine) automatically returns program execution to the instruction
following the JSR instruction in your calling ladder file.
The RET instruction terminates execution of the DII
TIP
subroutine (SLC 5/03 and higher processors), STI
subroutine, I/O event-driven interrupt subroutine,
and the user fault routine (SLC 5/02 or higher
processor).
Program Flow Instructions
Publication 1747-RM001G-EN-P - November 2008
6-5
Table of Contents
loading

Table of Contents