Subroutine Define And Return - Sbn(92)/Ret(93 - Omron C200H Operation Manual

Hide thumbs Also See for C200H:
Table of Contents

Advertisement

Subroutines and Interrupt Control
5-20-2
SUBROUTINE DEFINE and RETURN – SBN(92)/RET(93)
Limitations
Description
Precautions
Flags
188
Whereas subroutine calls are controlled from within the main program, sub-
routines activated by interrupts are triggered when the interrupt signal is re-
ceived. Also, multiple interrupts from different Interrupt Input Units can occur
at the same time. To effectively deal with this, the PC employs a priority
scheme for handling interrupts.
In the case of the scheduled interrupt, the time interval between interrupts is
set by the user and is unrelated to the cycle timing of the PC. This capability
is useful for periodic supervisory or executive program execution.
INT(89) is used to control the interrupt signals received from the Interrupt
Input Units, and also to control the scheduling of the scheduled interrupt.
INT(89) provides such functions as masking of interrupts (so that they are
recorded but ignored) and clearing of interrupts.
Ladder Symbols
SBN(92) N
RET(93)
Each subroutine number can be used in SBN(92) once only, i.e., up to 100
subroutines may be programmed. Subroutine numbers 00 through 31 are
used by Interrupt Input Units and subroutine number 99 is used for the
scheduled interrupt. Refer to 5-20-4 INTERRUPT CONTROL – INT(89) for
details.
SBN(92) is used to mark the beginning of a subroutine program; RET(93) is
used to mark the end. Each subroutine is identified with a subroutine number,
N, that is programmed as a definer for SBN(92). This same subroutine num-
ber is used in any SBS(91) that calls the subroutine (see next subsection).
No subroutine number is required with RET(93).
All subroutines must be programmed at the end of the main program. When
one or more subroutines have been programmed, the main program will be
executed up to the first SBN(92) before returning to address 00000 for the
next cycle. Subroutines will not be executed unless called by SBS(91) or acti-
vated by an interrupt.
END(01) must be placed at the end of the last subroutine program, i.e., after
the last RET(93). It is not required at any other point in the program. (Refer to
the next subsection for further details.)
If SBN(92) is mistakenly placed in the main program, it will inhibit program
execution past that point, i.e., program execution will return to the beginning
when SBN(92) is encountered.
If either DIFU(13) or DIFU(14) is placed within a subroutine, the operand bit
will not be turned OFF until the next time the subroutine is executed, i.e., the
operand bit may stay ON longer than one cycle.
There are no flags directly affected by these instructions.
Section 5-20
Definer Data Areas
N: Subroutine number
# (00 to 99)

Advertisement

Table of Contents
loading

Table of Contents