Omron C200HE Computer Hardware User Manual


 
285
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.
Precautions 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.
Flags There are no flags directly affected by these instructions.
5-23-5 MACRO MCRO(99)
I1: First input word
IR, SR, AR, DM, HR, TC, LR
Ladder Symbols
Operand Data Areas
O1: First output word
IR, SR, AR, DM, HR, LR
MCRO(99)
N
I1
O1
@MCRO(99)
N
I1
O1
N: Subroutine number
000 to 255
Limitations I1 through I1+3 must be in the same data area, as must O1 through O1+3.
Description 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 290 to SR 293, and 4 output words, SR 294 to SR 297, 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.
When the execution condition is OFF, MCRO(99) is not executed. When the
execution condition is ON, MCRO(99) copies the contents of I1 to I1+3 to SR 290
to SR 293, copies the contents of O1 to O1+3 to SR 294 to SR 297, and then calls
and executes the subroutine specified in N. When the subroutine is completed,
the contents of SR 294 through SR 297 are then transferred back to O1 to O1+3
before MCRO(99) is completed.
Subroutines and Interrupt Control Section 5-23