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 ( <variable declaration optional with initialization> )+ END_STRUCT END_TYPE
<structure name>
is an identifier which is valid in the entire project so that you can use it like
a standard data type. Moreover, you can declare any number of variables (at least
one) which are supplemented optionally by an initialization.
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.)
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