Omron SYSMAC C200HS Operation Manual page 268

Programmable controllers
Hide thumbs Also See for SYSMAC C200HS:
Table of Contents

Advertisement

Subroutines and Interrupt Control
Description
258
A subroutine can be executed by placing SBS(91) in the main program at the
point where the subroutine is desired. The subroutine number used in SBS(91)
indicates the desired subroutine. When SBS(91) is executed (i.e., when the ex-
ecution condition for it is ON), the instructions between the SBN(92) with the
same subroutine number and the first RET(93) after it are executed before ex-
ecution returns to the instruction following the SBS(91) that made the call.
SBS(91) 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(91) 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(93) has been reached), program ex-
ecution returns to the original subroutine which is then completed before return-
ing to the main program. Nesting is possible to up to sixteen levels. A subroutine
cannot call itself (e.g., SBS(91) 00 cannot be programmed within the subroutine
defined with SBN(92) 00). The following diagram illustrates two levels of nesting.
SBN(92) 10
SBS(91) 10
SBS(91) 11
Main program
SBS(91)
00
Main program
SBN(92)
00
Subroutine
RET(93)
END(01)
SBN(92) 11
SBS(91) 12
RET(93)
RET(93)
Section 5-23
SBN(92) 12
RET(93)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents