beautypg.com

Preface – Rockwell Automation 1761 MicroLogix 1000 Programmable Controllers User Manual

Page 182

background image

Preface

MicroLogix 1000 Programmable Controllers User Manual

10–4

Jump to Subroutine (JSR), Subroutine (SBR), and
Return (RET)

The JSR, SBR, and RET instructions are used to direct the controller to execute a
separate subroutine file within the ladder program and return to the instruction
following the JSR instruction.

Note

If you use the SBR instruction, the SBR instruction must be the first instruction on
the first rung in the program file that contains the subroutine.

Use a subroutine to store recurring sections of program logic that must be executed
from several points within your application program. A subroutine saves memory
because you program it only once.

Update critical I/O within subroutines using immediate input and/or output
instructions (IIM, IOM), especially if your application calls for nested or relatively
long subroutines. Otherwise, the controller does not update I/O until it reaches the
end of the main program (after executing all subroutines).

Outputs controlled within a subroutine remain in their last state until the
subroutine is executed again.

False

22.24

True

4.25

JSR

1.45

0.99

SBR

Execution Times (

µ

sec) when:

31.11

3.16

RET

JSR

JUMP TO SUBROUTINE
SBR file number

SBR

SUBROUTINE

RET

RETURN

...