Installation manual

Publication 1747-RM001G-EN-P - November 2008
Program Flow Instructions 6-3
Using LBL
This input instruction is the target of JMP instructions having the same label
number. You must program this instruction as the first instruction of a rung.
This instruction has no control bits.
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.
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.
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).
TIP
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.
JSR
JUMP TO SUBROUTINE
SBR file number
SBR
SUBROUTINE
RET
RETURN
.
.
.
Fixed SLC
5/01
SLC
5/02
SLC
5/03
SLC
5/04
SLC
5/05
•••••
TIP
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.
ATTENTION
Outputs controlled within a subroutine remain in
their last state until the subroutine is executed again.