beautypg.com

Rockwell Automation 1772-LS_LSP,D17726.8.6 PROG/OPER MANUAL-MINI PLC-2/05 User Manual

Page 150

background image

Jump Instructions and Subroutines

Chapter 13

13-2

Jump to Subroutine

Purpose: The Jump to Subroutine instruction is an output instruction. It
has an octal identification number from 00-07. When its rung is true, it
instructs the processor to jump from the main program to the label
instruction having the same number in the subroutine area. Subroutine
execution begins at that point.

This instruction always causes the processor to cross the boundary from
the main program to the subroutine area.

010

00

JSR

02

Return

Purpose: The Return instruction is an output instruction. It is used only in
the subroutine area to terminate a subroutine or selectable timed interrupt
and return the processor to the main program or, in the case of nested
subroutines, return program execution to the preceding subroutine. It
returns program execution to the instruction immediately following the
Jump to Subroutine instruction that initiated the subroutine. Program
execution continues from that point.

It is programmed as an output instruction without an identification number
in the subroutine area. It is usually programmed unconditional. Every
subroutine must have a return instruction.

RET

Subroutine Area

Keystrokes: You enter a Jump, Jump to Subroutine, or Return instruction
by performing the following steps.

1.

Press -(JMP)-, -(SR)-, or [SHIFT] -(RET)-.

Important: Do not perform step 2 for a Return instruction.

2.

Enter .