![Omron CVM1D Скачать руководство пользователя страница 371](http://html1.mh-extra.com/html/omron/cvm1d/cvm1d_operation-manual_742532371.webp)
(150)
SBN
001
(152)
RET
(151)
SBS
001
0000
00
(Subroutine)
(Other instructions)
366
Example
When CIO 000000 is ON in the following example, the instructions between
SBN(150) 001 and RET(152) are executed once before returning to execute the
next instruction line after SBS(151).
Address
Instruction
Operands
00000
LD
000000
00001
SBS(151)
001
(Other instructions)
00023
SBN(150)
001
(Subroutine)
00035
RET(152)
5-30-2 SUBROUTINE CALL: SBS(151)
(151)
SBS
N
N: Subroutine number
#
Operand Data Area
Ladder Symbol
Variations
j
SBS(151)
A subroutine can be executed by placing SBS(151) in the main program at the
point where the subroutine is desired. The subroutine number used in SBS(151)
indicates the desired subroutine. When SBS(151) is executed with an ON ex-
ecution, the instructions between the SBN(150) with the same subroutine num-
ber and the first RET(152) after it are executed before execution returns to the
instruction following the SBS(151) that made the call.
SBS(151)
00
SBN(150)
00
RET(152)
END(001)
Main program
Subroutine
Main program
SBS(151) may be used as many times as desired in the program, i.e., the same
subroutine may be called from different places in the program.
SBS(151) may also be placed into a subroutine to shift program execution from
one subroutine to another, i.e., subroutines may be nested. When the second
subroutine has been completed (i.e., RET(152) has been reached), program ex-
ecution returns to the original subroutine which is then completed before return-
ing to the main program. As many nesting levels as desired can be programmed.
A subroutine cannot call itself, (e.g., SBS(151) 00 cannot be programmed within
Description
Subroutines
Section 5-30
Содержание CVM1D
Страница 462: ...SYSMAC CVM1D Duplex System Programmable Controllers Operation Manual Revised August 2001...
Страница 463: ...iv...
Страница 465: ...vi...