Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

Array Types

An array is a fixed-size indexed collection of elements of the same type.

IEC 61131-3

Section 2.3.3.1

Support

Not yet supported

Syntax

ARRAY [ lower_bound .. upper_bound ] OF element_type

Arrays can be declared inline in variable declarations or as named types.

Example

TYPE
    TenInts : ARRAY [1..10] OF INT;
END_TYPE

PROGRAM main
    VAR
        values : ARRAY [0..9] OF DINT;
        matrix : ARRAY [1..3, 1..3] OF REAL;
    END_VAR

    values[0] := 42;
    values[5] := values[0] + 1;
END_PROGRAM

Multi-dimensional arrays use comma-separated ranges in the index specification.

See Also