Omron CP1L CPU UNIT - 06-2007 Operation Manual page 179

Cp1l cpu unit
Table of Contents

Advertisement

Index Registers
1,2,3...
Index Register
Initialization
Setting Index Registers
Direct Addressing
146
Since some operands are treated as word data and others are treated as bit
data, the meaning of the data in an Index Register will differ depending on the
operand in which it is used.
1. Word Operand:
MOVR(560)
0000
MOV(021)
D0
When the operand is treated as a word, the contents of the Index Register
are used "as is" as the PLC memory address of a word.
In this example MOVR(560) sets the PLC memory address of CIO 2 in IR2
and the MOV(021) instruction copies the contents of D0 to CIO 2.
2. Bit Operand:
MOVR(560)
000013
SET
+5 , IR2
When the operand is treated as a bit, the leftmost 7 digits of the Index Reg-
ister specify the word address and the rightmost digit specifies the bit num-
ber. In this example, MOVR(560) sets the PLC memory address of CIO 13
(0C00D hex) in IR2. The SET instruction adds +5 from bit 13 (D hex) to this
PLC memory address, so it turns ON bit CIO 1.02.
The Index Registers will be cleared in the following cases:
1. When the operating mode is changed from PROGRAM to RUN or MONI-
TOR mode or vice-versa
2. When the power is cycled
Always set the required value in an index register before using it. The contents
of an index register will be unpredictable if it is not set in advance.
The contents of an index register is also unpredictable after an interrupt task
is started. When using index registers inside an interrupt task, use
MOVR(560) (for anything but timer/counter PVs) or MOVRW(561) (for
timer/counter PVs) to set the required value.
When an Index Register is used as an operand without a "," prefix, the instruc-
tion will operate on the contents of the Index Register itself (a two-word or
"double" value). Index Registers can be directly addressed only in the instruc-
tions shown in the following table. Use these instructions to operate on the
Index Registers as pointers.
The Index Registers cannot be directly addressed in any other instructions,
although they can usually be used for indirect addressing.
Instruction group
Data Movement
Instructions
Table Data Processing
Instructions
Increment/Decrement
Instructions
IR2
, IR2
,IR2
Instruction name
MOVE TO REGISTER
MOVE TIMER/COUNTER PV TO REG-
ISTER
DOUBLE MOVE
DOUBLE DATA EXCHANGE
SET RECORD LOCATION
GET RECORD NUMBER
DOUBLE INCREMENT BINARY
DOUBLE DECREMENT BINARY
Section 4-11
Mnemonic
MOVR(560)
MOVRW(561)
MOVL(498)
XCGL(562)
SETR(635)
GETR(636)
++L(591)
– –L(593)

Advertisement

Table of Contents
loading

Table of Contents