In the programming, a variable is identified by its name and has an address in the memory of the target system. Accordingly, variable names are identifiers under which the allocated memory is addressed. The size of the variable is determined by its data type. This determines how much memory is reserved for the variable and how the values in memory are to be interpreted. The data type also determines which operators are allowed.
In CODESYS, there is also the capability of instantiating function blocks. Function block instances then use memory like variables do. The memory requirement is determined by the function block.
The following groups of data types are available.
Standard data types
A standard data type (or 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
Extensions of the IEC 61131-3 standard
User-defined data types
You can declare your own data types which are based on the default predefined data types or existing data types.
These kinds of data types are called user-defined or user-specific. The data types are either organized as its own DUT object or declared within the declaration part of a programming object. Moreover, they are differentiated according to their purpose and syntax.
User-Defined Data Type |
Declaration |
See also |
---|---|---|
Alias |
DUT object |
|
Arrays |
Programming object |
|
Enumeration |
DUT object, programming object |
|
Reference |
Programming object |
|
Pointer |
Programming object |
|
Structure |
DUT object |
|
Subrange type |
Programming object |
|
Union |
DUT object |
|
Vector |
DUT object |




NOTICE

Note the recommendations for naming an identifier.
See also