The EN 61131-3 defines the basic set of data types listed in the table below, including keywords, bit length, range, and initial value.
Keyword | Type | Bits | Range | Initial value |
---|---|---|---|---|
BOOL | Boolean number | 1 | 0, 1 | 0 |
SINT | Short integer | 8 | -128 to 127 | 0 |
INT | Integer | 16 | -32768 to 32767 | 0 |
DINT | Integer, double length | 32 | -2 147 483 648 to 2 147 483 647 | 0 |
LINT | Long integer | 64 | -9223372036854775808 to 9223372036854775807 | 0 |
USINT | Unsigned short integer | 8 | 0 to 255 | 0 |
UINT | Unsigned integer | 16 | 0 to 65535 | 0 |
UDINT | Unsigned integer, double length | 32 | 0 to 4294967295 | 0 |
ULINT | Unsigned long integer | 64 | 0 to 18446744073709551615 | 0 |
REAL | Floating point number (single precision) | 32 | -3.40282347E+38 to 3.40282347E+38 (closest to zero is 1.401298E-45) | 0.0 |
LREAL | Floating point number (double precision) | 64 | -1.7976931348623157E+308 to 1.7976931348623157E+308 (closest to zero is 4.94065645841247E-324) | 0.0 |
TIME | Time period duration | 64 | - | T#0s |
LTIME | Time period duration | 64 | units: ns | T#0s |
DATE | Date | 64 | - | 1.1.1970 00:00:00 |
LDATE | Date | 64 | units: ns since 1.1. 1970 | LDATE#1970-01-01 |
TIME_OF_DAY (short: TOD) | Time in a day | 64 | - | TOD#00:00:00 |
LTIME_OF_DAY (short: LTOD) | Time in a day | 64 | units: ns since 1.1. 1970 | LTOD#00:00:00 |
DATE_AND_TIME (short: DT) | Absolute time | 64 | - | - |
LDATE_AND_TIME (short: LDT) | Absolute time | 64 | units: ns since 1.1. 1970 | LDT1970-01-01-00:00:00 |
STRING | String of characters | 16 | max. 255 characters | '' (empty string) |
BYTE | Sequence of 8 bits | 8 | 16#FF | 16#00 |
WORD | Sequence of 16 bits | 16 | 16#FFFF | 16#0000 |
DWORD | Sequence of 32 bits | 32 | 16#FFFFFFFF | 16#00000000 |
LWORD | Sequence of 64 bits | 64 | 16#FFFFFFFFFFFFFFFF | 16#0000000000000000 |