Macro - Mcro(99) - Omron CQM1H - PROGRAM Programming Manual

Programmable controllers; inner boards
Table of Contents

Advertisement

Special Instructions
5-28-4 MACRO – MCRO(99)
Limitations
Description
Using Macros
1,2,3...
Ladder Symbols
MCRO(99)
@MCRO(99)
N
I1
O1
DM 6144 to DM 6655 cannot be used for O1.
The MACRO instruction allows a single subroutine to replace several subrou-
tines that have identical structure but different operands. There are 4 input
words, IR 096 to IR 099, and 4 output words, IR 196 to IR 199, 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 IR
096 to IR 099, copies the contents of O1 to O1+3 to IR 196 to IR 199, and
then calls and executes the subroutine specified in N. When the subroutine is
completed, the contents of IR 196 through IR 199 is then transferred back to
O1 to O1+3 before MCRO(99) is completed.
The macro function allows a single subroutine (programming pattern) to be
used by simply changing the I/O word. A number of similar program sections
can be managed with just one subroutine, thereby greatly reducing the num-
ber of steps in the program and making the program easier to understand.
To use a macro, call a subroutine by means of the MACRO instruction,
MCRO(99), as shown below, instead of SBS(91) (SUBROUTINE ENTRY).
When MCRO(99) is executed, operation will proceed as follows:
1. The contents of the four consecutive words beginning with the first input
word will be transferred to IR 096 through IR 099. The contents of the four
consecutive words beginning with the first output word will be transferred
to IR 196 through IR 199.
2. The specified subroutine will be executed until RET(93) (Subroutine Re-
turn) is executed.
3. The contents of IR 196 through IR 199 will be transferred to the four con-
secutive words beginning with the first output word.
4. MCRO(99) will then be finished.
When MCRO(99) is executed, the same instruction pattern can be used as
needed simply by changing the first input word or the first output word.
N: Subroutine number
N
IR, SR, AR, DM, EM, HR, TIM/CNT, LR
I1
O1: First output word
O1
IR, SR, AR, DM, EM, HR, LR
MCRO(99)
Subroutine No
First input word
First output word
Section 5-28
Operand Data Areas
000 to 127
I1: First input word
383

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cqm1h seriesSysmac cqm1h-cpu series

Table of Contents