We have ability to
create structures, that will contain other structures and also arrays or
standard variables:
In the example above
two structures have been created and second one contain variable of datatype of
the first structure.
The Implementation of IEC also supports arrays of structures. Here is an example of addressing the first element of the first array in ArrayOfStruct variable.
We also can create enumerated type of variable:
In example above
StateMachine1 variable has been created with type of StateMachine enum.
And this enumerated
variable has defined values of Idle, Homing, Active and Error.
The ST code is
showing how to use this variable in Case statement as Machine State.
The only difference from other implementations of IEC61131 is that values ( idle, home, active, error) do not have numerical representation, and they need to be addressed as in the example code.