Publication 1762-RM001C-EN-P
4-4 Programming Instructions Overview
Indirect Addressing
Indirect addressing allows components within the address to be used as
pointers to other data locations within the controller. This functionality
can be especially useful for certain types of applications, recipe
management, batch processing and many others. Indirect addressing can
also be difficult to understand and troubleshoot. It is recommended that
you only use indirect addressing when it is required by the application
being developed.
The MicroLogix 1200 and 1500 support indirection (indirect addressing)
for Files, Words and Bits. To define which components of an address are
to be indirected, a closed bracket “[ ]” is used. The following examples
illustrate how to use indirect addressing.
Indirect Addressing of a Word
•
Address: N7:[N10:1]
•
In this example, the element number to be used for source A in the
ADD instruction is defined by the number located in N10:1. If the
value of location N10:1 = 15, the ADD instruction operates as
“N7:15 + Source B”.
•
In this example, the element specified by N10:1 must be between 0
and 255, because all data files have a maximum individual size of 256
elements.
NOTE
If a number larger than the number of elements in the
data file is placed in N10:1 (in this example), data
integrity cannot be guaranteed, because a file
boundary will be crossed. This may not generate a
controller fault, but the data location is invalid/
unknown.
0000
B3:0
0
ADD
Add
Source A N7:[N10:1]
0<
Source B 1234
1234<
Dest N11:33
0<
ADD