Subroutine Define And Return -- Sbn(92)/Ret(93); Macro -- Mcro - Omron CPM1 Programming Manual

Hide thumbs Also See for CPM1:
Table of Contents

Advertisement

7-25-2 SUBROUTINE DEFINE and RETURN - - SBN(92)/RET(93)
Limitations
Description
Precautions
Flags
7-25-3 MACRO - - MCRO(99)
Limitations
Description
Ladder Symbols
SBN(92) N
RET(93)
The subroutine number must be between 000 and 049.
Each subroutine number can be used in SBN(92) once only.
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 number is
used in any SBS(91) that calls the subroutine (see 7-25-1 SUBROUTINE EN-
TER -- SBS(91)). 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).
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.
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 oper-
and bit may stay ON longer than one cycle.
There are no flags directly affected by these instructions.
Ladder Symbols
MCRO(99)
@MCRO(99)
N
I1
O1
The subroutine number must be between 000 and 049.
If a DM address is used for O1, O1 through O1+3 must be read/write DM.
The MACRO instruction allows a single subroutine to replace several subrou-
tines that have identical structure but different operands. There are 4 input
words (SR 232 to SR 235) and 4 output words (SR 236 to SR 239), allocated to
MCRO(99). These 8 words are used in the subroutine and take their contents
from I1 to I1+3 and O1 to O1+3 when the subroutine is executed.
Definer Data Areas
Operand Data Areas
N
IR, SR, AR, DM, HR, TC, LR
I1
O1
IR, SR, AR, DM, HR, LR
Section
7-25
N: Subroutine number
000 to 049
N: Subroutine number
000 to 127
I1: First input word
O1: First output word

Advertisement

Table of Contents
loading

This manual is also suitable for:

Srm-v2Cpm1aCpm2aSrm1Cpm2c

Table of Contents