Using sbr, Using ret – Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 221

Advertising
background image

Chapter 12
Using Program Flow Control Instructions

12–5

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. Use of
this instruction is optional; however, we recommend using it for clarity.

Important: The instruction must be programmed as the first instruction of

the first rung of a subroutine. (Since it must be the first
instruction on the rung, the SBR instruction is also known as
LD SBR.)

Entering the Instruction

You enter the instruction from within the program monitor functional area.

P 0 0 0

S B R

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.

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.

Entering the Instruction

You enter the instruction from within the program monitor functional area.

P 0 1 4

R E T

3

U

3

U

ENT

1

FUN

To enter the function code, press:

4

3

U

ENT

1

FUN

To enter the function code, press:

Advertising