Subroutine Call: Sbs(151) - Omron SYSMAC CVM1 Series Operation Manual

Duplex system
Hide thumbs Also See for SYSMAC CVM1 Series:
Table of Contents

Advertisement

Subroutines
Example
0000
00
(Other instructions)
(Subroutine)

5-30-2 SUBROUTINE CALL: SBS(151)

Ladder Symbol
Variations
j SBS(151)
Description
366
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).
(151)
SBS
(150)
SBN
(152)
RET
Operand Data Area
(151)
N: Subroutine number
SBS
N
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.
Main program
SBS(151)
Main program
SBN(150)
Subroutine
RET(152)
END(001)
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
001
001
#
00
00
Section 5-30
Address Instruction
Operands
00000
LD
000000
00001
SBS(151)
(Other instructions)
00023
SBN(150)
(Subroutine)
00035
RET(152)
001
001

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cv seriesSysmac cvm1d series

Table of Contents