Macro: Mcro(156) - Omron SYSMAC CVM1 Series Operation Manual

Duplex system
Hide thumbs Also See for SYSMAC CVM1 Series:
Table of Contents

Advertisement

Subroutines

5-30-3 MACRO: MCRO(156)

Ladder Symbol
(156)
MCRO N
Variations
↑MCRO(156)
Description
Precautions
Flags
Example
0000
00
(156)
MCRO 010 0200 0300
(Other instructions)
(Subroutine)
368
Operand Data Areas
N: Subroutine number
S
D
S: First input parameter word
D: First output parameter word
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).
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.
ER (A50003):
Subroutine does not exist for the specified subroutine number.
A subroutine has called itself.
An active subroutine has been called.
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.
Main program
(150)
SBN 010
Subroutine
(152)
RET
Section 5-30
000 to 999 or 000 to 099
CIO, G, A, T, C, DM
CIO, G, A, T, C, DM
Address
Instruction
Operands
00000
LD
00001
MCRO(156)
(Other instructions)
00023
SBN(150)
(Subroutine)
00035
RET(152)
000000
010
0200
0300
010

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cv seriesSysmac cvm1d series

Table of Contents