EasyManuals Logo
Home>Omron>Controller>CPM1

Omron CPM1 Programming Manual

Omron CPM1
541 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #151 background imageLoading...
Page #151 background image
130
Macro Function Section 2-3
2-3 Macro Function
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.
Using Macros To use a macro, call a subroutine by means of the MACRO instruction,
MCRO(99), as shown below, in stead of SBS(91) (SUBROUTINE ENTRY).
When MCRO(99) is executed, operation will proceed as follows:
1,2,3... 1. The contents of the four consecutive words beginning with the first input
word will be transferred to IR 096 through IR 099 (SR 232 through SR 235
in CPM1/CPM1A/SRM1 PCs). The contents of the four consecutive words
beginning with the first output word will be transferred to IR 196 through IR
199 (SR 236 through SR 239 in CPM1, CPM1A and SRM1 PCs).
2. The specified subroutine will be executed until RET(93) (Subroutine Re-
turn) is executed.
3. The contents of IR 196 through IR 199 (SR 236 through SR 239 in CPM1/
CPM1A/SRM1 PCs) will be transferred to the four consecutive words be-
ginning 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.
The following restrictions apply when the macro function is used.
• The only words that can be used for each execution of the macro are the
four consecutive words beginning with the first input word number (for
input) and the four consecutive words beginning with the first output word
(for output).
• The specified inputs and outputs must correctly correspond to the words
used in the subroutine.
• Even when the direct output method is used for outputs,subroutine results
will be actually reflected in the specified output words only when the sub-
routine has been completed (step 3 above).
Note 1. In CQM1 PCs, IR 096 to IR 099 and IR 196 to IR 199 can be used as work
bits when MCRO(99) is not used.
2. In CPM1/CPM1A/SRM1 PCs, SR 232 through SR 239 can be used as
work bits when MCRO(99) is not used.
The first input word and the first output word can be specified not with I/O bits,
but also with other bits (such as HR bits, work bits, etc.) or with DM words.
Subroutines called by MCRO(99) are defined by SBN(92) and RET(93), just
as are ordinary subroutines.
MCRO(99)
Subroutine No
Fist input word
First output word

Table of Contents

Other manuals for Omron CPM1

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron CPM1 and is the answer not in the manual?

Omron CPM1 Specifications

General IconGeneral
BrandOmron
ModelCPM1
CategoryController
LanguageEnglish

Related product manuals