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
Data Types in PLC ProgrammingVideo: Instrumentation Tools on YouTube. Shown for reference; EDWartens is not affiliated with or endorsed by Instrumentation Tools.

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

Type
Size
Range
Use
BOOL
1 bit
true/false
Contacts, coils, states
BYTE
8 bits
0 to 255
Raw bytes, bit packing
INT
16 bits signed
−32,768 to 32,767
Analog raw values, counts
UINT / WORD
16 bits
0 to 65,535
Modbus registers, status words
DINT
32 bits signed
±2.1 billion
Totalisers, encoder counts
REAL
32-bit float
about 7 significant digits
Engineering values
LREAL
64-bit float
about 15 digits
Precision maths, positions
TIME
32 bits
ms
Timer presets
STRING
variable
text
HMI 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.

To learn this with an instructor in a classroom, see classroom PLC training in Bangalore.

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.

Learn this, free

The courses that teach this

Every lesson, the written notes and the practice are free with an account. Only the certificate is optional and paid.

Start Your Engineering Career at EDWartens

Join as a Junior Engineer at Wartens Automation Pvt Ltd. Learn PLC and SCADA in our Electronic City classroom on wired PLC panels, and earn a Wartens Experience Certificate. Job guarantee or programme fee refunded (conditions apply). It runs for the nine months after you complete the programme. See the placement policy.