Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 219

Advertising
background image

Chapter 12
Using Program Flow Control Instructions

12–3

You can program multiple jumps to the same label by assigning the same
label number to multiple JMP instructions. However, label numbers must be
unique.

Important: Do not jump (JMP) into an MCR zone. Instructions that are

programmed within the MCR zone starting at the LBL
instruction and ending at the ‘END MCR’ instruction are
always evaluated as though the MCR zone is true, regardless of
the true state of the “Start MCR” instruction.

Entering the Instruction

You enter the instruction from within the program monitor functional area.
Asterisks appear on the display to indicate that the HHP is waiting for data
entry (i.e., a number).

P 0 0 9

L B L

L B L #

2

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.

Important: 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. (Since it must be the first instruction
on the rung, the SBR instruction is also known as LD SBR.)

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).

!

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

3

U

ENT

1

FUN

To enter the function code, press:

1

JSR

JUMP TO SUBROUTINE
SBR file number

10

SBR

SUBROUTINE

RET

RETURN

..

.

False

22.24

True

4.25

JSR

1.45

0.99

SBR

Execution Times (

µ

sec) when:

31.11

3.16

RET

Ladder representation:

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

Advertising