beautypg.com

Rockwell Automation 1772-LP3 PLC - 2/30 Programmable Controller Programming and Operations Manual User Manual

Page 214

background image

Jump Instructions and

Subroutine Programming

Chapter 11

11Ć13

Figure 11.10

(a) Three Levels of Nested Subroutines

(b) A Subroutine Can Call Itself or Loop

Subroutine

Level 1

Subroutine

Level 2

Subroutine

Level 3

( JSR )

( RET )

( JSR )

( RET )

( RET )

02

03

( JSR )

01

Main

Program

LBL

01

LBL

02

LBL

03

a

b

c

d

e

f

Subroutine Area

(A.)

LBL

( SCT )

01

051

| / |

15

( JSR )

051

01

PR 999

AC 000

( JSR )

01

Main

Program

Subroutine Area

(B.)

( CTR )

051

PR 009

AC 000

( RET )

Your Subroutine

End XXXXX