PLC Training

PLC Data Types and Addressing Across Brands: Siemens, Allen-Bradley, Mitsubishi and CODESYS Side by Side

EDWartens Engineering Team
4 min read
PLC Data Types and Addressing Across Brands: Siemens, Allen-Bradley, Mitsubishi and CODESYS Side by Side

Why data types cause so many faults

A tag that overflows at 32,767 because somebody used INT for a totaliser. A REAL compared with equality that is never true. A word written into a bit address by mistake. A Modbus register mapped into the wrong half of a DINT. Most "strange" PLC behaviour comes from a data type or an address, and the rules differ just enough between brands to trip experienced people.

Data types in PLC programming: bit, integer, real, word, timer, counter, by Instrumentation Tools

The core types

TypeSizeRangeUse
BOOL1 bittrue/falseContacts, coils, states
BYTE8 bits0 to 255Raw bytes, bit packing
INT16 bits signed−32,768 to 32,767Analog raw values, counts
UINT / WORD16 bits0 to 65,535Modbus registers, status words
DINT32 bits signed±2.1 billionTotalisers, encoder counts
REAL32-bit floatabout 7 significant digitsEngineering values
LREAL64-bit floatabout 15 digitsPrecision maths, positions
TIME32 bitsmsTimer presets
STRINGvariabletextHMI messages, recipes

The rule that saves the most trouble: count in DINT, measure in REAL, never compare REALs for equality.

Core data types and their ranges
Core data types and their ranges

Siemens S7-1200 and S7-1500

  • Types follow IEC names: Bool, Int, DInt, Real, LReal, Time, String, plus Word, DWord, Byte and the Char family.
  • Addressing: I0.0, Q0.1, M10.3 for bits; IW64, QW80, MW20 for words; ID, QD, MD for double words. Data blocks are optimised (symbolic only) or standard (absolute DB1.DBW2).
  • Analog inputs read 0 to 27,648 for 0 to 100 percent of range.
  • Timers are IEC TON/TOF/TP instances in FBs, or the legacy S5 timers.

Allen-Bradley Logix (CompactLogix, ControlLogix)

  • Types: BOOL, SINT, INT, DINT, REAL, STRING, plus TIMER, COUNTER and user-defined types (UDT).
  • Addressing is tag based: no memory addresses. I/O appears as Local:1:I.Data.0 and structured module tags. The base integer is DINT, not INT; use DINT unless a device needs INT.
  • Analog inputs are scaled in the module configuration to engineering units.
  • Timers are structures with .PRE, .ACC, .DN, .TT, .EN.

Mitsubishi (GX Works2 and GX Works3)

  • Devices: X inputs, Y outputs, M internal relays, D data registers, T timers, C counters, with octal numbering for X and Y on FX.
  • Types: Bit, Word (16-bit signed), Double Word (32-bit), FLOAT (single precision), String. A 32-bit value occupies D100 and D101.
  • Labels in GX Works3 add IEC-style names on top of devices.

CODESYS, Beckhoff, and the IEC reference

  • Full IEC types including LINT, ULINT, LREAL, WSTRING, LTIME.
  • %I, %Q, %M addressing with IEC syntax: %IX0.0 (bit), %IW2 (word), %MD4 (double word).
  • Structures, arrays, enumerations and unions exactly as the standard defines.
Addressing styles side by side
Addressing styles side by side

Modbus and the 16-bit trap

Modbus registers are 16 bits. A 32-bit REAL or DINT spans two registers, and vendors disagree on word order (big-endian, little-endian, and byte-swapped variants). When a flow reads 1.4e-45 instead of 12.5, the word order is wrong. The Industrial Communication course has the four combinations to try.

Interview questions

  • What happens when an INT totaliser passes 32,767? It wraps to −32,768.
  • Why not compare REAL values with equality? Floating point representation; compare with a tolerance.
  • Difference between WORD and INT? Same size; WORD is unsigned bit pattern, INT is signed number.
  • Where is Siemens M memory versus a DB? M is bit memory; DBs are structured data with symbolic access.
Studio 5000 data types: BOOL, INT, DINT and REAL, by Tim Wilborne

Practise it

The TIA Portal, Studio 5000, GX Works3 and CODESYS courses each have a data types module; do the analog scaling exercise in two of them and the differences will stick.

Frequently asked questions

Should I use INT or DINT by default on Siemens? Int is native for I/O; DInt for counts and maths. On Rockwell, DINT always.

What is a UDT? A user-defined structure: a valve with .Open, .Closed, .Cmd, .Fault fields, instantiated for every valve.

How do I convert between types? With explicit conversion instructions (INT_TO_REAL, CONV, MOVE with conversion). Implicit conversion is where errors hide.

Start Your Engineering Career at EDWartens

Join as a Junior Engineer at Wartens Automation Pvt Ltd. Get hands-on PLC SCADA training, industry certifications, and a 100% Job Guarantee backed by a 100% refund policy.