
Drive PLC Developer Studio
IEC 61131-3 Data types
10-6
l
DDS EN 2.3
No enumeration value must be used twice.
Example:
TRAFFICLIHTS: (red, yellow, green);
COLOUR: (blue, white, red);
Error: red must not be used for TRAFFICLIGHTS and COLOUR.
10.2.4 Structures
Structures are saved as objects in the
Object Organizer
on the index card Data types, start with the
keywords TYPE and STRUCT and end with END_STRUCT and END_TYPE.
Structure declarations have the following syntax:
TYPE <Structure name>:
STRUCT
<Variable declaration 1>
.
.
<Variable declaration n>
END_STRUCT
END_TYPE
<Structure name> is now a type known throughout the entire project and can be used like a standard
data type.
Nested structures are permitted, the only restriction being that variables cannot be set to addresses.
An AT declaration is not permitted!
Structure components are accessed with the following syntax:
<Structure_name>.<Component name>
For instance, the structure ”Week” including the component ”Monday” can beaccessed as follows:
Week.Monday
Example:
Structure definition for a polygon
TYPE Polygon:
STRUCT
Start: ARRAY [1..2] OF INT;
Point1:ARRAY [1..2] OF INT;
Point2:ARRAY [1..2] OF INT;
Point3:ARRAY [1..2] OF INT;
Point4:ARRAY [1..2] OF INT;
End: ARRAY [1..2] OF INT;
END_STRUCT
END_TYPE
Comentarios a estos manuales