Attention
These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.
P2022¶
- Code
P2022
- Message
Array must have at least one dimension
Array declarations must specify at least one dimension. An array without dimensions is not valid in IEC 61131-3.
Example¶
The following code will generate error P2022:
TYPE
MY_ARRAY : ARRAY [] OF INT;
END_TYPE
This error occurs because the array dimension specification is empty - there are no ranges specified between the brackets.
To fix this error, specify at least one dimension range:
TYPE
MY_ARRAY : ARRAY [1..10] OF INT;
END_TYPE
Multi-dimensional arrays are also valid:
TYPE
MATRIX : ARRAY [1..3, 1..4] OF REAL;
END_TYPE