Omron SYSMAC CP Series Instruction & Reference Manual page 327

Cpu unit
Hide thumbs Also See for SYSMAC CP Series:
Table of Contents

Advertisement

Function
SBS(091) calls the subroutine with the
specified subroutine number. The subrou-
tine is the program section between
SBN(092) and RET(093). When the sub-
routine is completed, program execution
continues with the next instruction after
SBS(091).
A subroutine can be called more than
once in a program.
Subroutines can be nested up to 16 lev-
els. Nesting is when another subroutine is
called from within a subroutine program,
such as shown in the following example,
which is nested to 3 levels.
SBN 10
to
SBS 11
to
RET
CP1E CPU Unit Instructions Reference Manual(W483)
SBN 11
SBN 12
to
to
SBS 12
to
RET
RET
SBS
n
Main program
B
SBN
Subroutine
n
program
(SBN(092) to
RET(093))
A
RET
END
SBS
n
Main program
D
SBN
n
A
Subroutine
SBS
program n
m
C
Two-level
RET
nesting
SBN
m
Subroutine
program m
B
RET
END
2 Instructions
Execution condition ON
B
A
Program end
Execution condition ON
D
A
Execution condition ON
C
B
Program end
2-291
2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents