PLC & Data
PLC Data Type Ranges
Value ranges for the IEC 61131-3 data types, with a check of whether a value fits and what it will do if it does not.
Calculated reference results
- Smallest type that holds this value
- DINT (32-bit signed)
- Fits in an INT
- No
- Fits in a DINT
- Yes
- Exact in a REAL
- Yes
- Modbus registers needed
- 2 registers (32 bit)
Will overflow and wrap in a 16-bit signed tag.
Below about 16.7 million, integers are exact in single precision.
Modbus registers are 16 bits. Anything larger spans two, and the word order matters.
The arithmetic
- Value = 3,000,000
- Types that hold it: DINT, UDINT, LINT
- Integers below 2^24 are represented exactly in IEEE 754 single precision
What this does not account for
- Integer overflow in a PLC does not usually raise an error. The value wraps silently, so a run-hour counter in an INT rolls over at 32,767 and starts counting from a large negative number.
- A REAL has about 7 significant decimal digits. A totalizer that reaches 10 million stops resolving single units, which shows up as a totalizer that appears to stall.
- Storing a 32-bit value across two Modbus registers requires both sides to agree on word order. There is no standard, and mismatched order produces values that look like noise.
How this is calculated
The IEC 61131-3 integer types are bounded by their bit width: an INT is 16-bit signed and holds -32,768 to 32,767, a DINT is 32-bit signed and holds about plus or minus 2.1 billion. A REAL is IEEE 754 single precision with roughly 7 significant decimal digits, which is why a large totalizer loses resolution when stored in one.
The table below lists the ranges for the common IEC 61131-3 types. Vendor implementations vary in which types they support and in what they call them.
Assumptions and limitations built into this calculator
- Two-complement signed integers and IEEE 754 floating point, which is what common PLC platforms use.
- Vendor-specific types and platform extensions are not covered.
Frequently asked questions
- Why did my run-hour counter go negative?
- It overflowed a 16-bit signed integer. Above 32,767 the value wraps to -32,768 and counts up again. Use a DINT for anything that accumulates.
- Should a totalizer be a REAL or a DINT?
- A DINT, or a pair of values holding whole units and a remainder. A REAL loses single-unit resolution above about 16.7 million, which makes a large totalizer appear to stop advancing.
Direct contact
Have a controls question?
Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.