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

Jump Instructions and Subroutines
Chapter 13
13-6
You can program a maximum of eight subroutines in the subroutine area.
Each subroutine begins with a label instruction and (when you want to exit
to your main program) ends with a return instruction. The subroutine area
serves as the end of the main program and defines the beginning of the
subroutine program (Figure 13.2).
Figure 13.2
Subroutine Programming Example
114
06
EN
File To File Move
Counter Addr:
Position:
File Length:
File A:
File R:
001
007
400Ć 406
500Ć 506
DN
012
00
JSR
01
014
06
11
012
01
LBL
012
02
013
012
10
U
OFF 11
116
11
200
U
OFF 17
116
02
116
13
Rate Per Scan
007
200
17
200
15
200
JSR
01
11
116
12
116
13
116
Here general programming facts for the subroutine instruction:
Uses one word in the data table
Processor does not scan the instruction until you program a Jump to
Subroutine instruction.
Up to eight subroutines can be programmed if you do not program any
jump instructions.
You cannot nest subroutine programs by inserting a Jump to Subroutine
instruction in the Subroutine area.
It is possible to jump from one subroutine to another using a
Jump instruction.