Data types

In programming, a variable is identified by its name and has an address in the target system's memory. Variable names are therefore identifiers under which the allocated storage space is addressed. The size of the variable is determined by its data type. This specifies how much storage space is reserved for the variable and how the values in memory are to be interpreted. The data type also determines which operations are allowed.

In TwinCAT there is also the possibility to instantiate function blocks. Function block instances then occupy memory in a similar way to variables. The memory requirement is determined by the function block.

The following groups of data types are available:

Standard data types

A standard data type is an elementary data type or a string data type.

<standard data type> : __UXINT | __XINT | __XWORD | BIT | BOOL | BYTE | DATE | DATE_AND_TIME | DINT | DT | DWORD | INT | LDATE | LDATE_AND_TIME | LDT | LINT | LREAL | LTIME | LTOD | LWORD | REAL | SINT |STRING | TIME | TOD | TIME_OF_DAY | UDINT | UINT | ULINT | USINT | WORD | WSTRING

See also:

Extensions of the IEC 61131-3 standard

See also:

User-defined data types

You can declare your own data types based on the default predefined ones or on existing data types.

Such data types are called user-defined or user-specific. The data types are either organized as a separate DUT object or declared within the declaration part of a programming object. They are also distinguished based on their purpose and syntax.

User-defined data type

Declaration

See also

Alias

DUT object

Alias

Arrays

Programming object

ARRAY

Enumeration

DUT object, programming object

Enumerations

Pointer

Programming object

POINTER

Reference

Programming object

REFERENCE

Structure

DUT object

Structure

Subrange type

Programming object

Subrange Types

Union

DUT object

UNION

Data types 1:

Note the recommendations for naming identifiers.

See also: