Object ‘DUT’

Symbol: for DUT without text list support; for DUT (type: enumeration) with text list support

A DUT (data unit type) describes a user-specific data type. You can add a DUT object below the application or in the POUs view.

When adding the object, you can specify definition (see below: Dialog box Add DUT).

Syntax

TYPE <identifier> : <DUT component declaration>
END_TYPE

The component declaration depends on the selected type, structure, or enumeration.

Example:

The following two DUTs define the structures struct1 and struct2, in which struct2 extends struct1. This mean that struct2.a can be used to access the a variable.

TYPE struct1 :
STRUCT
    a:INT;
    b:BOOL;
END_STRUCT
END_TYPE

TYPE struct2 EXTENDS struct1 :
STRUCT
    c:DWORD;
    d:STRING;
END_STRUCT
END_TYPE

See also

Dialog Box ‘Add DUT’

Function: You use this dialog box log for configuring a new DUT. The DUT (Data Unit Type) describes a user-specific data type.

Call: Menu bar Project ‣ Add object ‣ DUT ; context menu of the application object.

Name DUT name
Data type
Structure

The DUT consists of a structure of various data types.

Extends: : The structure extends an existing structure. In this way, the definitions of the extended DUT are automatically valid in the new DUT.

Enumeration

The DUT consists of a series of integer constants. For declaration syntax, please refer to the help page for “Enumerations”.

Add text list support: : The text list support allows the localization of enumeration components. In addition, both the symbolic and numeric enumeration values are shown in the text display of a visualization element. When an enumeration variable with text list support is specified in the Text variable property of a visualization element, the enumeration variable obtains the additional <enumeration name>.

By clicking the buttons on the right edge of the editor, you can switch between Textual view and Localized view (text list). The DUT object is found as the symbol in the device tree and in the POUs view.

Example: You use the PLC_PRG.enVar variable (type myEnum). myEnum is a DUT with text list support. Then the entry in the property editor looks like PLC_PRG.enVar <myEnum>. If the enumeration type is modified in the application, then you are prompted to allow CODESYS to update the affected visualizations accordingly.

Note: Text list support can be added or removed at any time for an existing enumeration object. For this purpose, the commands Add text list support and Remove text list support are provided in the context menu of the object.

: An enumeration is created without text list support. The DUT object is found as the symbol in the device tree and in the POUs view.

Alias

Definition of an alias for a Base type.

You can type in the base type directly or select it using the input assistant or array assistant.

Union All components reserve the same storage space for this data type. The memory requirement of a union is determined by the memory requirement of its “largest” component.

See also