beautypg.com

11ć10, 1 subroutine area – Rockwell Automation 1772-LP3 PLC - 2/30 Programmable Controller Programming and Operations Manual User Manual

Page 211

background image

Jump Instructions and

Subroutine Programming

Chapter 11

11Ć10

The area reserved for subroutines is located in memory between the
main program and the message store areas. Its boundary is displayed as
subroutine area, and serves as the end of program statement for the main
program. Subroutines are not scanned by the processor unless directed to
do so by the Jump to Subroutine instruction.

The subroutine area can only be established by placing the cursor on
the last instruction in main program and pressing the key sequence
[SHIFT][SBR]. The boundary marker, SUBROUTINE AREA, will
appear. A subroutine area instruction can only be programmed as the last
instruction in the main program. It cannot be inserted between rungs. It
requires one memory word, can be programmed only once, and cannot
be removed except by clearing the entire subroutine area or the entire
memory.

Up to 64 subroutines can be programmed in the subroutine area. Each
subroutine begins with a Label instruction and ends with a return
instruction. The Return instruction returns program execution to the
instruction immediately following the Jump to Subroutine instruction that
caused the specific subroutine to be executed. Program execution continues
from that point. Figure 11.9 shows a representative subroutine area.

Rungs which are part of the subroutine are entered by placing the cursor on
the subroutine area and pressing [

], then entering the rung.

11.3.1
Subroutine Area