🎒 SchoolNEW 💡 Suggest

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.

TypeBitsBytesSignMinMaxIEC 61131-3Siemens S7 / TIARockwell / Allen-BradleyCodesys / BeckhoffModbus registersTypical use
BOOL11/8 (1)³bit stringFALSE (0)TRUE (1)BOOLBOOLBOOLBOOL (1 byte), BIT⁴1 coil / 1 bitinputs, outputs, flags, limit switches
BYTE81bit string16#0016#FF (255)BYTEBYTESINT (no BYTE)BYTE½8 bits together, status bytes, protocols
WORD162bit string16#000016#FFFF (65535)WORDWORDINT (no WORD)WORD1status and control words, bit masks
DWORD324bit string16#0000_000016#FFFF_FFFF (4294967295)DWORDDWORDDINT (no DWORD)DWORD2drive control words, 32-bit masks
LWORD648bit string16#0000_0000_0000_000016#FFFF_FFFF_FFFF_FFFF (18446744073709551615)LWORDLWORD (S7-1500)LINT (no LWORD)LWORD464-bit masks, IDs, raw timestamps
SINT81signed-128127SINTSINT (S7-1200/1500)SINTSINT½small signed values, offsets
USINT81unsigned0255USINTUSINT (S7-1200/1500)USINT¹USINT½small counters, codes, 0–255 values
INT162signed-3276832767INTINTINTINT1analog values (0–27648), counters, setpoints
UINT162unsigned065535UINTUINT (S7-1200/1500)UINT¹UINT1counters, unsigned Modbus registers
DINT324signed-21474836482147483647DINTDINTDINTDINT2encoder positions, part counters, milliseconds
UDINT324unsigned04294967295UDINTUDINT (S7-1200/1500)UDINT¹UDINT2long counters, operating hours
LINT648signed-92233720368547758089223372036854775807LINTLINT (S7-1500)LINTLINT4energy totals, large absolute positions
ULINT648unsigned018446744073709551615ULINTULINT (S7-1500)ULINT¹ULINT464-bit counters, ns timestamps
REAL324signed-3.4028235E+383.4028235E+38REALREALREALREAL2measurements, PID, scaling (≈ 7 digits)
LREAL648signed-1.7976931348623157E+3081.7976931348623157E+308LREALLREAL (S7-1200/1500)LREAL¹LREAL4precise maths, totalisers, axes (≈ 15–16 digits)
CHAR81—16#0016#FFCHARCHARSINT (STRING.DATA)BYTE / STRING(1)½one ASCII / ISO 8859-1 character
WCHAR162—16#000016#FFFFWCHARWCHAR (S7-1200/1500)—WORD / WSTRING(1)1one Unicode character (UCS-2)
STRING8·(n+2)n+2 (S7)—''254 char (S7)STRINGSTRING[n], n ≤ 254STRING (82 char, 88 byte)STRING(n): n+1 byte, n=80(n+2)/2recipes, barcodes, HMI messages
WSTRING16·(n+2)2·n+4 (S7)—""16382 char (S7)WSTRINGWSTRING[n] (S7-1200/1500)—WSTRING(n): 2·(n+1) byten+2multilingual texts, non-Latin scripts
TIME324signedT#-24d20h31m23s648msT#24d20h31m23s647msTIMETIME (ms)DINT ms (.PRE/.ACC)²TIME (ms, 0…T#49d17h2m47s295ms)2IEC timers (TON, TOF, TP), cycle times
LTIME648signedLT#-106751d23h47m16s854ms775us808nsLT#106751d23h47m16s854ms775us807nsLTIMELTIME (ns, S7-1500)LTIME (ns)²LTIME (ns)4precision timers, motion, ns measurements
S5TIME162—S5T#0MSS5T#2H46M30S—S5TIME (S7-300/400/1500)——1classic S5 timers (SE, SD, SI…) on S7-300/400
DATE162unsignedD#1990-01-01D#2168-12-31DATEDATE (giorni/days 1990)—DATE (32 bit, s 1970…D#2106-02-07)1production dates, deadlines, calendars
TOD324unsignedTOD#00:00:00.000TOD#23:59:59.999TIME_OF_DAYTOD / TIME_OF_DAY (ms)—TOD (ms)2shift times, scheduled switching
DT648—DT#1990-01-01-00:00:00.000DT#2089-12-31-23:59:59.999DATE_AND_TIMEDT (BCD, S7-300/400/1500)DT (µs 1970)²DT (32 bit, s 1970)4alarm and log timestamps (classic S7)
DTL9612—DTL#1970-01-01-00:00:00.0DTL#2262-04-11-23:47:16.854775807LDT⁵DTL (S7-1200/1500)DINT[7] (WallClockTime)LDT (64 bit, ns 1970)6CPU 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.

What do you think?

Your rating