Common Attributes for Advanced Process Control and Drives Instructions
Rockwell Automation Publication 1756-RM006K-EN-P - November 2018 551
To dynamically change the array element that your logic references, use tag or
expression as the subscript to point to the element. This is similar to indirect
addressing in PLC-5 logic. Use these operators in an expression to specify an array
subscript:
Tips:
Logix Designer allows subscripts that are extended data type tags only, and does not support subscript
expressions that have extended data types.
• All available integer elementary data types can be used as a subscript index. Only use SINT, INT, and
DINT tags with operators to create a subscript expression.
Operator Description
+ add
- subtract/negate
* multiply
/ divide
AND AND
FRD BCD to integer
NOT complement
OR OR
TOD integer to BCD
SQR square root
XOR exclusive OR
For example:
Definitions Example Description
my_list defined as DINT[10] my_list[5] This example references
element 5 in the array. The
reference is static because
the subscript value remains
constant.
my_list defined as DINT[10]
position defined as DINT
MOV the value 5 into position
my_list[position]
This example references
element 5 in the array. The
reference is dynamic
because the logic can
change the subscript by
changing the value
of position.
my_list defined as DINT[10]
position defined as DINT
offset defined as DINT
MOV the value 2 into position
MOV the value 5 into offset
my_list[position+offset]
This example references
element 7 (2+5) in the
array. The reference is
dynamic because the logic
can change the subscript
by changing the value of
position or offset.