What Is an Array?

It is a data item that contains a set of data of the same type, such as:

  • elementary data (EDT),

    for example:

    • a group of BOOL words,

    • a group of UINT integer words,

    • etc.

  • derived data (DDT),

    for example:

    • a group of WORD tables,

    • a group of structures,

    • Device derived data (Device DDT)

    • etc.

Characteristics

An array is characterized by two parameters:

  • a parameter which defines its organization (array dimension(s)),

  • a parameter that defines the type of data it contains.

NOTE: The most complex organization is the array with 15 dimensions and the array size could not be greater than 65535 bytes.

The syntax comprising these two parameters is:

Defining and Instancing an Array

Definition of an array type:

Instancing an array

The instances Tab_1 and Tab_2 are of the same type and the same dimension, the only difference being that during instancing:

  • the Tab_1 type takes the name X,

  • the Tab_2 type must be defined (unnamed table).

NOTE: It is beneficial to name the type, as any modification that has to be made will only be done so once, otherwise there will be as many modifications as there are instances.

Examples

This table presents the instances of arrays of different dimensions:

Entry

Comments

Tab_1: ARRAY[1..2] OF BOOL

1 dimensional array with 2 Boolean words

Tab_2: ARRAY[-10..20] OF WORD

1 dimensional array with 31 WORD type structures (structure defined by the user)

Tab_3: ARRAY[1..10, 1..20] OF INT

2 dimensional arrays with 10x20 integers

Tab_4: ARRAY[0..2, -1..1, 201..300, 0..1] OF REAL

4 dimensional arrays with 3x3x100x2 reals

NOTE: Many functions (READ_VAR, WRITE_VAR for example) don’t recognize the index of an array of words starting by a number different from 0. If you use such an index the functions will look at the number of words in the array, but not at the starting index set in the definition of the array.

Access to a data item in array Tab_1 and Tab_3:

Inter-Arrays Assignment Rules

There are the 4 following arrays: