Omron CP - PROGRAMMING MANUAL 05-2007 Programming Manual page 707

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Subroutines
0.00
0.01
3-18-2 MACRO: MCRO(099)
Purpose
Ladder Symbol
674
Example 3: Nested Subroutines
When CIO 0.00 is ON in the following example, subroutine 1 is executed. If
CIO 0.01 is ON, subroutine 2 is executed from within subroutine 1 and pro-
gram execution returns to the next instruction after SBS(091) 2 when subrou-
tine 2 is completed. Execution of subroutine 1 continues and program
execution returns to the next instruction after SBS(091) 1 when subroutine 1
is completed.
1
CIO 0.00 ON
1
5
1
2
CIO 0.01 ON
2
4
2
3
Subroutine 2
Calls the subroutine with the specified subroutine number and executes that
program using the input parameters in S to S+3 and the output parameters in
D to D+3.
MCRO(099)
N
S
D
0.00
Subroutine 1
N: Subroutine number
S: First input parameter word
D: First output parameter word
Section 3-18
Order of execution
0.01
A S1-1 S2 S1-2 B
A S1-1 S1-2 B
A B
A B

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents