5-19
5 I/O Memory
CP2E CPU Unit Software User’s Manual(W614)
5-8 In
de
x R
egister
s (IR)
5
Example
This example shows how to store the PLC memory address of a word (CIO 2) in an Index Register
(IR0), use the Index Register in an instruction, and use the auto-increment variation.
MOVR
2
IR0
Stores the PLC memory address of CIO 2 in IR0.
MOV
#0001
,IR0
Writes #0001 to the PLC memory address contained in IR0.
MOV
#0020
+1,IR0
Reads the content of IR0, adds 1, and writes #0020 to that PLC
memory address.
Note
The PLC memory addresses are listed in the diagram above, but it isn
’
t necessary to know the
PLC memory addresses when using Index Registers.
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.
•
Word Operand:
MOVR
0000
IR2
MOV
D0 ,IR2
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 sets the PLC memory address of CIO 2 in IR2 and the MOV instruction copies
the contents of D0 to CIO 2.
•
Bit Operand:
MOVR
00001
3
,IR2
SET
+5 , IR2
When the operand is treated as a bit, the leftmost 7 digits of the Index Register specify the word
address and the rightmost digit specifies the bit number. In this example, MOVR sets the PLC mem-
ory address of CIO 1
3
(0C00D hex) in IR2. The SET instruction adds +5 from bit 1
3
(D hex) to this
PLC memory address, so it turns ON bit CIO 1.02.
Additional Information
When MOVR is used to set a word address in an index register, the address is stored as follows:
When MOVR is used to set a bit address in an index register, the address is stored as follows:
#0001
#0020
Reg
u
l
a
r
d
a
t
a
a
re
a
a
ddre
ss
I/O memory
PLC memory
a
ddre
ss
MOVE TO REGI
S
TER
in
s
tr
u
ction MOVR(560) 0002 IR0
Pointer
0000
0001
0002
0003
0289
H000
H127
W000
W127
IR0
MOV #0001 ,IR0
01B80Hex
01B81Hex
01B82Hex
01B83Hex
01CA1Hex
01CC0Hex
01D3FHex
W000
0233FHex
022C0Hex
01B82Hex
W000
PLC memory address
31
0
Index register
31
4 3
0
PLC memory address
Index register
Bit number
Summary of Contents for SYSMAC CP Series
Page 3: ......
Page 32: ...1 Overview 1 4 CP2E CPU Unit Software User s Manual W614 ...
Page 44: ...3 CPU Unit Operation 3 8 CP2E CPU Unit Software User s Manual W614 ...
Page 116: ...6 I O Allocation 6 8 CP2E CPU Unit Software User s Manual W614 ...
Page 144: ...7 PLC Setup 7 28 CP2E CPU Unit Software User s Manual W614 ...
Page 170: ...10 Interrupts 10 14 CP2E CPU Unit Software User s Manual W614 ...
Page 200: ...11 High speed Counters 11 30 CP2E CPU Unit Software User s Manual W614 ...
Page 272: ...12 Pulse Outputs 12 72 CP2E CPU Unit Software User s Manual W614 ...
Page 278: ...13 PWM Outputs 13 6 CP2E CPU Unit Software User s Manual W614 ...
Page 460: ...18 Programming Device Operations 18 28 CP2E CPU Unit Software User s Manual W614 ...
Page 576: ...Revision 2 CP2E CPU Unit Software User s Manual W614 ...
Page 577: ......