171
Index Registers
Section 4-15
With the offset and increment/decrement variations, the Index Registers can
be set to base values with MOVR(560) or MOVRW(561) and then modified as
pointers in each instruction.
Note
It is possible to specify regions outside of I/O memory and generate an Illegal
Access Error when indirectly addressing memory with Index Registers. Refer
to
Appendix E Memory Map
for details on the limits of PLC memory
addresses.
The following table shows the variations available when indirectly addressing
I/O memory with Index Registers. (IR
@
represents an Index Register from IR0
to IR15.)
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(560)
2
IR0
Stores the PLC memory address of
CIO 2 in IR0.
MOV(021)
#0001
,IR0
Writes #0001 to the PLC memory ad-
dress contained in IR0.
MOV(021)
#0020
+1,IR0 Reads the content of IR0, adds 1,
and writes #0020 to that PLC memo-
ry address.
I/O Memory
Pointer
Set to a base value
with MOVR(560) or
MOVRW(561).
Variation
Function
Syntax
Example
Indirect addressing
The content of IR
@
is treated as
the PLC memory address of a bit
or word.
,IR
@
LD ,IR0
Loads the bit at the PLC
memory address contained
in IR0.
Indirect addressing
with constant offset
The constant prefix is added to the
content of IR
@
and the result is
treated as the PLC memory
address of a bit or word.
The constant may be any integer
from –2,048 to 2,047.
Constant ,IR
@
(Include a + or –
in the constant.)
LD +5,IR0
Adds 5 to the contents of IR0
and loads the bit at that PLC
memory address.
Indirect addressing
with DR offset
The content of the Data Register
is added to the content of IR
@
and
the result is treated as the PLC
memory address of a bit or word.
DR
@
,IR
@
LD
DR0,IR0
Adds the contents of DR0 to
the contents of IR0 and
loads the bit at that PLC
memory address.
Indirect addressing
with auto-increment
After referencing the content of
IR
@
as the PLC memory address
of a bit or word, the content is
incremented by 1 or 2.
Increment by 1:
,IR
@
+
Increment by 2:
,IR
@
++
LD , IR0++
Loads the bit at the PLC
memory address contained
in IR0 and then increments
the content of IR0 by 2.
Indirect addressing
with auto-decrement
The content of IR
@
is decre-
mented by 1 or 2 and the result is
treated as the PLC memory
address of a bit or word.
Decrement by 1:
,–IR
@
Decrement by 2:
,– –IR
@
LD , – –IR0 Decrements the content of
IR0 by 2 and then loads the
bit at that PLC memory
address.
Содержание CP1H CPU UNITS - PROGRAMMING 05-2007
Страница 2: ......
Страница 3: ...CP1H X40D CP1H XA40D CP1H Y20DT D CP1H CPU Unit Operation Manual Revised March 2009...
Страница 4: ...iv...
Страница 10: ...x...
Страница 18: ...xviii...
Страница 22: ...xxii...
Страница 34: ...xxxiv Conformance to EC Directives 6...
Страница 174: ...140 CP series Expansion I O Unit Wiring Section 3 6...
Страница 370: ...336 Analog I O XA CPU Units Section 5 5...
Страница 552: ...518 Trouble Shooting Section 8 7...
Страница 595: ...561 Sample Application Section 9 12 Network Settings Network Tab Network Settings Driver Tab...
Страница 598: ...564 Sample Application Section 9 12...
Страница 642: ...608 Standard Models Appendix A...
Страница 643: ...609 Appendix B Dimensions Diagrams X XA and Y CPU Units 90 100 110 140 150 8 85 Four 4 5 dia holes...
Страница 652: ...618 Dimensions Diagrams Appendix B...
Страница 745: ...711 Connections to Serial Communications Option Boards Appendix F Connecting to Unit...
Страница 746: ...712 Connections to Serial Communications Option Boards Appendix F...
Страница 776: ...742 PLC Setup Appendix G...
Страница 778: ...744 Specifications for External Power Supply Expansion Appendix H...
Страница 786: ...752 Revision History...