Native Data Types

Bitstring Types

BOOL, BYTE, WORD, DWORD, LWORD

Bitstring types of 1, 8, 16, 32 and 64 bit. Implicit conversion from left to right using zero extension.

Unsigned Integer Types

USINT, UINT, UDINT, ULINT

Unsigned integer types of 8, 16, 32 and 64 bit. Implicit conversion from left to right preserving the value.

Signed Integer Types

SINT, INT, DINT, LINT

Signed integer types of 8, 16, 32 and 64 bit. Implicit conversion from left to right preserving the value. An unsigned type of n bit is also implicitly converted to a signed type of m bit where the relation m > n must hold. There is no implicit conversion between bitstring types and integer types.

Floating Point Types

REAL, LREAL

Floating point data types of 32 and 64 bit. Implicit conversion from left to right preserving the value.

String Types

string[<length>]

wstring[<length>]

1-byte and 2-byte strings of given length. If length is omitted, it has 255 as default value.

Character Types

char

wchar

Single 1-byte and 2-byte character of a string. It can be implicitly converted to a string.

Time-Related Types

TIME, LTIME

DATE, LDATE

TIME_OF_DAY, TOD, LTIME_OF_DAY, LTOD

DATE_AND_TIME, DT, LDATE_AND_TIME, LDT

Datatypes for duration, date and time. Internally, all values of these types are represented with a granularity of 1 nanosecond. Values of date-related types represent the number of nanoseconds since 1.1.1970 (UTC). Leapseconds are ignored. Implicit conversion is allowed from a non-L type to an L type, e.g. from TIME to LTIME.