Skip to content

Data types

A data type is a classification that defines for literals and variables the possible values, the operations that can be performed, and the way the values are stored.

This page covers the elementary data types. To build your own types — structures, enumerations, arrays, subranges, sized strings and references — see derived types.

Data typeDescriptionDefault value
BOOLBoolean0, FALSE
SINTShort integer0
INTInteger0
DINTDouble integer0
LINTLong integer0
USINTUnsigned short integer0
UINTUnsigned integer0
UDINTUnsigned double integer0
ULINTUnsigned long integer0
REALReal numbers0.0
LREALLong real numbers0.0
TIMEDurationT#0s
LTIMEDurationLTIME#0s
DATEDateDATE#1970-01-01
LDATELong date LDATE#1970-01-01
TIME_OF_DAY or TOD Time of day TOD#00:00:00
LTIME_OF_DAY or LTODTime of dayLTOD#00:00:00
DATE_AND_TIME or DTDate and time of dayDT#1970-01-01-00:00:00
LDATE_AND_TIME or LDTDate and time of dayLDT#1970-01-01-00:00:00
STRINGOne-byte string of variable length “(blank)
WSTRINGVariable length double byte string“(blank)
 CHAR One-byte character $00
WCHAR Double byte character $0000
BYTE Bit sequence of length 8 16#00
WORD  Bit sequence of length 1616#0000
DWORDBit sequence of length 32 16#0000_0000
LWORDBit sequence of length 64 16#0000_0000_0000_0000

Elementary types are used directly in variable declarations. Each variable takes the default value from the table above unless you initialize it:

VAR
enabled : BOOL; // FALSE
count : INT := 5; // explicit initial value
ratio : LREAL; // 0.0
started : DT; // DT#1970-01-01-00:00:00
END_VAR