Data Types, Arrays, and Storing/Retrieving Values
The Truncation Trap
When a PLC performs math using Integers or Double Integers (DINT), it cannot store decimal places. Unlike standard rounding, many PLC platforms use truncation. This means any value after the decimal point is discarded.
Example: $99 / 100 = 0.99$. In a DINT destination, this becomes 0.
DINT vs. REAL
DINT (Double Integer): A 32-bit signed integer. Best for counting, indexing, or whole numbers.
REAL (Floating Point): A 32-bit memory area that follows IEEE 754 standards to represent fractional numbers. Essential for PID loops, scaling, and percentages.