Arrays
11
Arrays
Overview
11.1
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
Motor_Volts
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
Identifier
Motor_Volt
Training Manual GX IEC Developer
Address
D0
Type
ARRAY [0..3, 0...3] OF INT
= Motor_Volt [2, 3]
Type
Length
ARRAY
[0...2] OF INT
Overview
11 - 1