![Omron CVM1D Operation Manual Download Page 373](http://html1.mh-extra.com/html/omron/cvm1d/cvm1d_operation-manual_742532373.webp)
(156)
MCRO 010 0200 0300
0000
00
(150)
SBN 010
(152)
RET
Main program
Subroutine
(Subroutine)
(Other instructions)
368
5-30-3 MACRO: MCRO(156)
(156)
MCRO
N
S
D
Ladder Symbol
Variations
↑
MCRO(156)
Operand Data Areas
D: First output parameter word
CIO, G, A, T, C, DM
S: First input parameter word
CIO, G, A, T, C, DM
N: Subroutine number
000 to 999 or 000 to 099
Description
MCRO(156) allows a single subroutine to replace several subroutines that have
identical structure but different operands. There are four input words, A200
through A203, and four output words, A204 through A207, allocated to
MCRO(156). These eight words are used in the subroutine and take their con-
tents from S through S+3 and then output their contents to D through D+3 after
the subroutine is executed.
When the execution condition is OFF, MCRO(156) is not executed. When the
execution condition is ON, MCRO(156) copies the contents of S through S+3 to
A200 through A203, and then calls and executes the subroutine specified in N.
When the subroutine is completed, the contents of A204 through A207 are then
transferred back to D through D+3 before MCRO(156) is completed.
Subroutines called by MCRO(156) are defined by SBN(150) and RET(152) just
like normal subroutines. For details concerning the use of subroutines, refer to
the sections in this manual explaining SBN(150), SBS(151), and RET(152).
Precautions
Nesting is possible with MCRO(156), but the data must be saved before calling
another subroutine because there is only one processing area (A200 through
A207). Recursive calls are not possible, i.e., a subroutine cannot call itself.
N must be between 000 and 999.
Note Refer to page 101 for general precautions on operand data areas.
Flags
ER (A50003):
Subroutine does not exist for the specified subroutine number.
A subroutine has called itself.
An active subroutine has been called.
Example
When CIO 000000 is ON in the following example, the contents of CIO 0200
through CIO 0203 are copied to A200 through A203, and subroutine 10 is called
and executed. When the subroutine is completed, the contents of A204 through
A207 are copied back to CIO 0300 through CIO 0303.
Address
Instruction
Operands
00000
LD
000000
00001
MCRO(156)
010
0200
0300
(Other instructions)
00023
SBN(150)
010
(Subroutine)
00035
RET(152)
Subroutines
Section 5-30
Summary of Contents for CVM1D
Page 462: ...SYSMAC CVM1D Duplex System Programmable Controllers Operation Manual Revised August 2001...
Page 463: ...iv...
Page 465: ...vi...