11 Arrays
11.1 Overview
An array is a field or matrix of variables, of a particular type.
For example, an ARRAY [0..2] OF INT, is a one dimensional array of three integer elements
(0,1,2). If the start address of the array is D0, then the array consists of D0, D1 and D2.
Identifier Address Type Length
Motor_Volts D0 ARRAY [0...2] OF INT
In software, program elements can use: Motor_Volts[1] and Motor_Volts[2], as declarations,
which in this example mean that D1 and D2 are addressed.
Arrays can have up to three dimensions, for example: ARRAY [0...2, 0...4] has three elements in
the first dimension and five in the second. Arrays can provide a convenient way of ‘indexing’ tag
names, i.e. one declaration in the Local or Global Variable Table can access many elements.
The following diagrams illustrate graphical representation of the three array types.
Single Dimensional Array
Two Dimensional Array
Arrays Overview
Training Manual GX IEC Developer 11 - 1
Identifier
Motor_Volt
Ty p e
ARRAY [0..3, 0...3] OF INT
= Motor_Volt [2, 3]