![background image](http://html1.mh-extra.com/html/omron/sysmac-cs1d-cpu/sysmac-cs1d-cpu_reference-manual_742268854.webp)
815
Subroutines
Section 3-19
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.
Flags
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 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
3
2
1
1
000100
The subroutine is not executed
in following cycles.
Name
Label
Operation
Error Flag
ER
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.
Содержание SYSMAC CS1D-CPU**
Страница 3: ...iv...
Страница 29: ...xxx...
Страница 185: ...146 List of Instructions by Function Code Section 2 4...
Страница 193: ...154 3 35 4 MOVE BIT MOVBC 568 1274 3 35 5 BIT COUNTER BCNTC 621 1276 3 35 6 GET VARIABLE ID GETID 286 1278...
Страница 1389: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2...
Страница 1390: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits...
Страница 1391: ...1352 ASCII Code Table Appendix A...