Object DUT

Symbol:  icontextlistdut(DUT without text list support),  icondut(DUT of type enumeration with text list support)

A DUT (data unit type) describes a user-specific data type.


Creating an object DUT

Select a folder in the Solution Explorer in the PLC project tree.
In the context menu select the command Add > DUT...
The dialog Add DUT opens.
Enter a name and select a data type.
Click on Open.
The DUT is added to the PLC project tree and opens in the editor.

Dialog Add DUT

Name of the DUT


The DUT consists of a structure of different data types.
Extended: The structure extends an existing structure. The definitions of the extended DUT are therefore automatically valid in the new one.
(See also: Structure)
The DUT consists of a series of integer constants.
Textlist support  icon_activated: Textlist support enables localization of the enumeration components. In addition, the symbolic enumeration values (instead of the numerical values) are displayed in the text output of a visualization element. When a textlist-supported enumeration variable is entered in the Text variable property of a visualization element, the supplement <enumeration name> is added.
The buttons at the right edge of the editor can be used to switch between Textual view ( icontextualview) and Localization view (text list) ( icontabularview). The DUT object appears in the PLC project tree in the Solution Explorer with the following symbol:
Example: The variable MAIN.eVar of type E_myEnum is used. E_myEnum is a text list-supported DUT. The entry in the properties editor then looks as follows: MAIN.eVar <E_myEnum>. If the enumeration name is changed in the PLC project, a prompt appears with the question whether TwinCAT should update the affected visualizations accordingly.
Textlist support can be added to or removed from an existing enumeration object at any time: The commands Add text list support or Remove text list support in the context menu of the object can be used for this purpose.
Textlist support  icon_deactivated: An enumeration without text list support is created. The DUT object appears in the PLC project tree in the Solution Explorer with the following symbol:
(See also: Enumerations)
Definition of an alias for a pre-defined type.
You can enter the pre-defined type directly or select it via the input assistant or the array wizard.
With this data type, all components take up the same memory space. The memory footprint of a union is determined by the memory footprint of its “largest” component.
(See also: UNION)

Declaring a DUT


TYPE <Bezeichner> : <DUT Komponentendeklaration>

The component declaration depends on the selected type (e.g. structure or enumeration).


The following section shows two DUTs, which define the structures ST_Struct1 and ST_Struct2. The structure ST_Struct2 extends the structure ST_Struct1, which means that ST_Struct2.nVar1 can be used to access the variable anVar1.

TYPE ST_Struct1 :
    nVar1 : INT;
    bVar2 : BOOL;

TYPE ST_Struct2 EXTENDS ST_Struct1 :
    nVar3 : DWORD;
    sVar4 : STRING;