4 Understanding Programming
4-26
CP2E CPU Unit Software User’s Manual(W614)
4-6
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 or
MOVRW, 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.
Index Registers can be a powerful tool when combined with loops such as FOR-NEXT loops. The con-
tents of Index Registers can be incremented, decremented, and offset very easily, so a few instructions
in a loop can process tables of consecutive data very efficiently.
Basically, Index Registers are used with the following steps:
1
Use MOVR 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 indirectly address the
desired bit or word.
3
Offset or increment the original PLC memory address (see below) to redirect the pointer to
another address.
4
Continue steps 2 and
3
to execute the instruction on any number of addresses.
Note
Use any of the following methods to offset or increment an Index Register.
• Indirect Addressing of Index Registers:
Indirect addressing with auto-incrementing (,IR
@
+ or ,IR
@
++), indirect addressing with
auto-decrementing (,
−
IR
@
or ,
−−
IR
@
), indirect referencing with a constant offset (con-
stant,IR
@
), indirect addressing with a DR offset (DR
@
,IR
@
)
4-6-1
What are Index Registers?
4-6-2
Using Index Registers
IR
MO
V
R(560)
Index Register
Pointer
All areas of
I/O Memory
IR0
,IR0
Indirect
addressing
Increment IR0 and repeat
instruction execution
Table data
Instruction
Содержание SYSMAC CP Series
Страница 1: ...USER S MANUAL Cat No W614 E1 01 SYSMAC CP Series CP2E E D CP2E S D CP2E N D CP2E CPU Unit Software ...
Страница 3: ......
Страница 32: ...1 Overview 1 4 CP2E CPU Unit Software User s Manual W614 ...
Страница 44: ...3 CPU Unit Operation 3 8 CP2E CPU Unit Software User s Manual W614 ...
Страница 116: ...6 I O Allocation 6 8 CP2E CPU Unit Software User s Manual W614 ...
Страница 144: ...7 PLC Setup 7 28 CP2E CPU Unit Software User s Manual W614 ...
Страница 170: ...10 Interrupts 10 14 CP2E CPU Unit Software User s Manual W614 ...
Страница 200: ...11 High speed Counters 11 30 CP2E CPU Unit Software User s Manual W614 ...
Страница 272: ...12 Pulse Outputs 12 72 CP2E CPU Unit Software User s Manual W614 ...
Страница 278: ...13 PWM Outputs 13 6 CP2E CPU Unit Software User s Manual W614 ...
Страница 460: ...18 Programming Device Operations 18 28 CP2E CPU Unit Software User s Manual W614 ...
Страница 576: ...Revision 2 CP2E CPU Unit Software User s Manual W614 ...
Страница 577: ......