Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual page 503

Hide thumbs Also See for CPM1 - PROGRAMING MANUAL 02-2001:
Table of Contents

Advertisement

Subroutine Instructions
Flags
Caution
!
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
execution returns to the original subroutine which is then completed before re-
turning to the main program. Nesting is possible to up to sixteen levels. A sub-
routine cannot call itself (e.g., SBS(91) 000 cannot be programmed within the
subroutine defined with SBN(92) 000). The following diagram illustrates two lev-
els of nesting.
SBN(92) 010
SBS(91) 010
SBS(91) 011
The following diagram illustrates program execution flow for various execution
conditions for two SBS(91).
SBS(91)
Main
program
SBS(91)
C
SBN(92)
D
RET(93)
SBN(92)
Subroutines
RET(93)
END(01)
ER:
A subroutine does not exist for the specified subroutine number.
A subroutine has called itself.
An active subroutine has been called.
SBS(91) will not be executed and the subroutine will not be called when ER is
ON.
SBN(92) 011
SBS(91) 012
RET(93)
RET(93)
A
000
OFF execution conditions for
subroutines 000 and 001
A
B
001
ON execution condition for
subroutine 000 only
A
ON execution condition for
000
subroutine 001 only
A
ON execution conditions for
subroutines 000 and 001
001
A
E
Section
7-26
SBN(92) 012
RET(93)
B
C
D
B
C
B
E
C
D
B
E
C
485

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents