![background image](http://html1.mh-extra.com/html/omron/cj1g-cpu-series/cj1g-cpu-series_programming-manual_742489273.webp)
252
Index Registers
Section 6-2
6-2
Index Registers
6-2-1
What Are Index Registers?
Index Registers function as pointers to specify PLC memory addresses,
which are absolute memory addresses in I/O memory. After storing a PLC
memory address in an Index Register with MOVR(560) or MOVRW(561),
input the Index Register as an operand in other instructions to indirectly
address the stored PLC memory address.
The advantage of Index Registers is that they can specify any bit or word in I/
O memory, including timer and counter PVs.
6-2-2
Using Index Registers
Index Registers can be a powerful tool when combined with loops such as
FOR-NEXT loops. The contents of Index Registers can be incremented, dec-
remented, and offset very easily, so a few instructions in a loop can process
tables of consecutive data very efficiently.
Basic Operation
Basically, Index Registers are used with the following steps:
1,2,3...
1.
Use MOVR(560) to store the PLC memory address of the desired bit or
word in an Index Register.
2.
Specify the Index Register as the operand in almost any instruction to in-
directly address the desired bit or word.
3.
Offset or increment the original PLC memory address (see below) to redi-
rect the pointer to another address.
4.
Continue steps 2 and 3 to execute the instruction on any number of ad-
dresses.
Offsetting, Incrementing, and Decrementing Addresses
The following table shows the variations available for indirect addressing.
Pointer
All areas of
I/O Memory
MOVR(560)
Index Register
Increment IR0 and repeat
instruction execution
Table data
Indirect
addressing
Variation
Syntax
Indirect addressing
,IR
@
Indirect addressing with constant offset
Constant ,IR
@
(Include a + or – in the constant.)
Summary of Contents for CJ1G-CPU series
Page 3: ...iv...
Page 5: ...vi...
Page 21: ...xxii Conformance to EC Directives 6...
Page 169: ...148 Task Control Instructions Section 3 32...
Page 203: ...182 Programming Device Operations for Tasks Section 4 4...
Page 253: ...232 Using File Memory Section 5 3...
Page 337: ...316 Other Functions Section 6 11...
Page 347: ......
Page 369: ......
Page 373: ......
Page 379: ......
Page 381: ...360 Revision History...