A structure is a user-defined data type, which combines multiple variables of any data type into a logical unit. The variables declared within a structure are called members.
You make the type declaration of a structure in a “DUT” object which you create in the “Project Add Object DUT” menu or in the context menu of an application.
Syntax
TYPE <structure name>
STRUCT
<member name> : <data type> := <initialization> ;
END_STRUCT
END_TYPE
|
<structure name> |
This identifier is valid in the entire project so that you can use it like a standard data type. |
|
<member name> : <data type> ; |
Declaration of a member Any number of declarations can follow, but at least 2. Structures can also be nested. This means that you declare a structure member with an existing structure type. Then the only restriction is that you must not assign any address to the variable (structure member). The AT declaration is not permitted here. |
|
:= <initialization> |
Optional |
Example
Type declaration
TYPE S_POLYGONLINE :
STRUCT
aiStart : ARRAY[1..2] OF INT := [-99, -99];
aiPoint1 : ARRAY[1..2] OF INT;
aiPoint2 : ARRAY[1..2] OF INT;
aiPoint3 : ARRAY[1..2] OF INT;
aiPoint4 : ARRAY[1..2] OF INT;
aiEnd : ARRAY[1..2] OF INT := [99, 99];
END_STRUCT
END_TYPE
-
Extension of a type declaration
-
Declaration and initialization of structure variables
-
Access to a structure member
-
Symbolic bit access in structure variables