672
Subroutines Section 3-18
Precautions 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,2,3... 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.
Examples 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.
1
3
AS→B
A→B
CIO 0.00 ON
2
0.00
0.00
→
Subroutine 1
Main program
Subroutine program:
S
Order of execution