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

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Subroutines
Precautions
1,2,3...
Examples
Main program
Subroutine 1
672
SBS(091) and the corresponding SBN(092) must be programmed in the same
task. An error will occur if the corresponding SBN(092) is not in the task.
SBS(091) will be treated as NOP(000) when it is within a program section
interlocked by IL(002) and ILC(003).
When SBS(091) is executed in the following cases, the subroutine will not
actually be called and the Error Flag will be turned ON:
1. The specified subroutine is not defined within the current task.
2. The subroutine is calling itself.
3. Subroutine nesting exceeds 16 levels.
4. The specified subroutine is being executed.
Example 1: Sequential (Non-nested) Subroutines
When CIO 0.00 is ON in the following example, subroutine 1 is executed and
program execution returns to the next instruction after SBS(091). The remain-
der of the main program (through the instruction just before SBN(092) 1) is
then executed.
0.00
Subroutine program:
S
1
CIO 0.00 ON
3
0.00
2
Section 3-18
Order of execution
A
S
B
A
B

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents