Omron SYSMAC CJ - REFERENCE MANUAL 01-2008 Reference Manual page 854

Sysmac cs/cj/one nsj series programmable controllers
Table of Contents

Advertisement

Subroutines
Flags
Precautions
1,2,3...
Examples
In contrast, a differentiated instruction (UP, DOWN, DIFU(013) or DIFD(014))
would maintain the ON status if the instruction was executed and the output
was turned ON but the same subroutine was not called a second time.
In the following example, subroutine 0001 is executed if CIO 000000 is ON.
Output CIO 000100 is turned ON by DIFU(013) when CIO 000001 has gone
from OFF to ON. If CIO 000000 is OFF in the following cycle, subroutine
0001 will not be executed again and output CIO 000100 will remain ON.
Name
Label
Error Flag
ER
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 000000 is ON in the following example, subroutine 1 is executed
and program execution returns to the next instruction after SBS(091). The
remainder of the main program (through the instruction just before SBN(092)
1) is then executed.
1
1
3
1
The subroutine is not executed
in following cycles.
000100
2
Operation
ON if nesting exceeds 16 levels.
ON if the specified subroutine number does not exist.
ON if a subroutine calls itself.
ON if a subroutine being executed is called.
ON if the specified subroutine is not defined in the current
task.
OFF in all other cases.
Section 3-19
815

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents