PLC data types (complete table)
Pick a type to see its memory layout, why it has exactly that minimum and maximum and how many Modbus registers it takes. Below is the complete table with the names used by Siemens, Rockwell and Codesys/Beckhoff.
INT · 16 bit · 2 byte · Min -32768 · Max 32767 · Modbus registers 1
Indicative results: always verify with a qualified technician and the applicable standards. Legal notice
Bit strings and numbers
BYTE, WORD, DWORD and LWORD are bit strings: 8, 16, 32 or 64 bits read one by one, such as masks, status and control words. SINT, INT, DINT and LINT are signed numbers in two's complement; USINT, UINT, UDINT and ULINT are the same numbers unsigned. So the same 16 bits can mean 65535 (UINT), −1 (INT) or 16#FFFF (WORD): only the way the program reads them changes.
Siemens: S7-300/400 versus S7-1200/1500
Classic S7-300/400 CPUs know BOOL, BYTE, WORD, DWORD, INT, DINT, REAL, CHAR, STRING, TIME, S5TIME, DATE, TOD and DT. S7-1200 and S7-1500 add SINT, USINT, UINT, UDINT, LREAL, WCHAR, WSTRING and DTL. The 64-bit types LINT, ULINT, LWORD, LTIME, LTOD and LDT are available on S7-1500. In an optimized DB the byte addresses are not fixed: to exchange data byte by byte (Modbus, TCP, AT views) use a non-optimized DB or a structure with known offsets.
Rockwell and Codesys/Beckhoff
Rockwell Logix has no WORD or DWORD: bit strings live in SINT, INT or DINT and immediate values are always DINT. Unsigned types and LREAL exist only on 5380/5480/5580 CPUs. Codesys and TwinCAT have all IEC 61131-3 types, but beware: in Codesys TIME is unsigned, and DATE and DT count seconds since 1970 in 32 bits, while Siemens DATE counts days since 1990. Rockwell, Beckhoff and PCs are little-endian, Siemens is big-endian: the same REAL arrives with its bytes in a different order, see the byte decoder.
Modbus: 16-bit registers
Modbus only knows bits (coils) and 16-bit registers, high byte first. A DINT or REAL takes two registers, an LREAL four, a DTL six. The standard does not say which register comes first: some devices send the high word first (ABCD), others the low word (CDAB). If a value looks absurd, try the other orders.
Complete data types table
Click a row to see it in detail.
| Type | Bits | Bytes | Sign | Min | Max | IEC 61131-3 | Siemens S7 / TIA | Rockwell / Allen-Bradley | Codesys / Beckhoff | Modbus registers | Typical use |
|---|---|---|---|---|---|---|---|---|---|---|---|
| BOOL | 1 | 1/8 (1)³ | bit string | FALSE (0) | TRUE (1) | BOOL | BOOL | BOOL | BOOL (1 byte), BIT⁴ | 1 coil / 1 bit | inputs, outputs, flags, limit switches |
| BYTE | 8 | 1 | bit string | 16#00 | 16#FF (255) | BYTE | BYTE | SINT (no BYTE) | BYTE | ½ | 8 bits together, status bytes, protocols |
| WORD | 16 | 2 | bit string | 16#0000 | 16#FFFF (65535) | WORD | WORD | INT (no WORD) | WORD | 1 | status and control words, bit masks |
| DWORD | 32 | 4 | bit string | 16#0000_0000 | 16#FFFF_FFFF (4294967295) | DWORD | DWORD | DINT (no DWORD) | DWORD | 2 | drive control words, 32-bit masks |
| LWORD | 64 | 8 | bit string | 16#0000_0000_0000_0000 | 16#FFFF_FFFF_FFFF_FFFF (18446744073709551615) | LWORD | LWORD (S7-1500) | LINT (no LWORD) | LWORD | 4 | 64-bit masks, IDs, raw timestamps |
| SINT | 8 | 1 | signed | -128 | 127 | SINT | SINT (S7-1200/1500) | SINT | SINT | ½ | small signed values, offsets |
| USINT | 8 | 1 | unsigned | 0 | 255 | USINT | USINT (S7-1200/1500) | USINT¹ | USINT | ½ | small counters, codes, 0–255 values |
| INT | 16 | 2 | signed | -32768 | 32767 | INT | INT | INT | INT | 1 | analog values (0–27648), counters, setpoints |
| UINT | 16 | 2 | unsigned | 0 | 65535 | UINT | UINT (S7-1200/1500) | UINT¹ | UINT | 1 | counters, unsigned Modbus registers |
| DINT | 32 | 4 | signed | -2147483648 | 2147483647 | DINT | DINT | DINT | DINT | 2 | encoder positions, part counters, milliseconds |
| UDINT | 32 | 4 | unsigned | 0 | 4294967295 | UDINT | UDINT (S7-1200/1500) | UDINT¹ | UDINT | 2 | long counters, operating hours |
| LINT | 64 | 8 | signed | -9223372036854775808 | 9223372036854775807 | LINT | LINT (S7-1500) | LINT | LINT | 4 | energy totals, large absolute positions |
| ULINT | 64 | 8 | unsigned | 0 | 18446744073709551615 | ULINT | ULINT (S7-1500) | ULINT¹ | ULINT | 4 | 64-bit counters, ns timestamps |
| REAL | 32 | 4 | signed | -3.4028235E+38 | 3.4028235E+38 | REAL | REAL | REAL | REAL | 2 | measurements, PID, scaling (≈ 7 digits) |
| LREAL | 64 | 8 | signed | -1.7976931348623157E+308 | 1.7976931348623157E+308 | LREAL | LREAL (S7-1200/1500) | LREAL¹ | LREAL | 4 | precise maths, totalisers, axes (≈ 15–16 digits) |
| CHAR | 8 | 1 | — | 16#00 | 16#FF | CHAR | CHAR | SINT (STRING.DATA) | BYTE / STRING(1) | ½ | one ASCII / ISO 8859-1 character |
| WCHAR | 16 | 2 | — | 16#0000 | 16#FFFF | WCHAR | WCHAR (S7-1200/1500) | — | WORD / WSTRING(1) | 1 | one Unicode character (UCS-2) |
| STRING | 8·(n+2) | n+2 (S7) | — | '' | 254 char (S7) | STRING | STRING[n], n ≤ 254 | STRING (82 char, 88 byte) | STRING(n): n+1 byte, n=80 | (n+2)/2 | recipes, barcodes, HMI messages |
| WSTRING | 16·(n+2) | 2·n+4 (S7) | — | "" | 16382 char (S7) | WSTRING | WSTRING[n] (S7-1200/1500) | — | WSTRING(n): 2·(n+1) byte | n+2 | multilingual texts, non-Latin scripts |
| TIME | 32 | 4 | signed | T#-24d20h31m23s648ms | T#24d20h31m23s647ms | TIME | TIME (ms) | DINT ms (.PRE/.ACC)² | TIME (ms, 0…T#49d17h2m47s295ms) | 2 | IEC timers (TON, TOF, TP), cycle times |
| LTIME | 64 | 8 | signed | LT#-106751d23h47m16s854ms775us808ns | LT#106751d23h47m16s854ms775us807ns | LTIME | LTIME (ns, S7-1500) | LTIME (ns)² | LTIME (ns) | 4 | precision timers, motion, ns measurements |
| S5TIME | 16 | 2 | — | S5T#0MS | S5T#2H46M30S | — | S5TIME (S7-300/400/1500) | — | — | 1 | classic S5 timers (SE, SD, SI…) on S7-300/400 |
| DATE | 16 | 2 | unsigned | D#1990-01-01 | D#2168-12-31 | DATE | DATE (giorni/days 1990) | — | DATE (32 bit, s 1970…D#2106-02-07) | 1 | production dates, deadlines, calendars |
| TOD | 32 | 4 | unsigned | TOD#00:00:00.000 | TOD#23:59:59.999 | TIME_OF_DAY | TOD / TIME_OF_DAY (ms) | — | TOD (ms) | 2 | shift times, scheduled switching |
| DT | 64 | 8 | — | DT#1990-01-01-00:00:00.000 | DT#2089-12-31-23:59:59.999 | DATE_AND_TIME | DT (BCD, S7-300/400/1500) | DT (µs 1970)² | DT (32 bit, s 1970) | 4 | alarm and log timestamps (classic S7) |
| DTL | 96 | 12 | — | DTL#1970-01-01-00:00:00.0 | DTL#2262-04-11-23:47:16.854775807 | LDT⁵ | DTL (S7-1200/1500) | DINT[7] (WallClockTime) | LDT (64 bit, ns 1970) | 6 | CPU clock (RD_SYS_T, RD_LOC_T), logging |
¹ Rockwell: USINT, UINT, UDINT, ULINT and LREAL only on CompactLogix 5380/5480, ControlLogix 5580 and later. ² Rockwell: classic timers use DINT in ms; TIME, LTIME and DT exist in recent Logix firmware. ³ In a Siemens optimized DB and in Codesys a BOOL takes 1 byte; in I/Q/M areas and standard DBs it is 1 bit. ⁴ BIT: Codesys/TwinCAT type allowed only inside structures and function blocks. ⁵ IEC 61131-3 has no DTL: the equivalent type is LDT (LDATE_AND_TIME, ns since 1970). ½ = two 8-bit values in one Modbus register. Modbus: 1 register = 16 bits, high byte first; the register order for 32- and 64-bit types is not fixed by the standard.
Frequently asked questions
What is the range of an INT?
An INT is a signed 16-bit integer: from −32768 to +32767 (16#8000 … 16#7FFF). An unsigned UINT goes from 0 to 65535.
What is the range of a DINT?
A DINT is a signed 32-bit integer: from −2147483648 to +2147483647. A UDINT goes from 0 to 4294967295.
How many Modbus registers does a REAL use?
Two: a Modbus register has 16 bits and a REAL has 32. An LREAL uses four. The order of the two registers (ABCD or CDAB) depends on the device.
What is the difference between WORD and INT?
Both have 16 bits. WORD is an unsigned bit string (16#0000 … 16#FFFF) for masks and status words; INT is a signed number. The same bits 16#FFFF are 65535 as WORD/UINT and −1 as INT.
What is the difference between DT and DTL in Siemens?
DT (DATE_AND_TIME) takes 8 bytes in BCD, covers 1990–2089 and goes down to milliseconds. DTL takes 12 binary bytes, covers 1970–2262, goes down to nanoseconds and includes the weekday. S7-1200/1500 CPUs use DTL.