Troubleshooting
Displaying a PLC Real Value Over Modbus on an HMI
Short answer
An INTEGER display that reads the register proves the link, station and address, so a blank REAL display is a 32-bit mapping fault. Declare the HMI variable as a 32-bit float on the register pair (40064/40065), set the device double-word order to Low Word First to match the PLC, and give the numeric field six integer digits for 628402.0.
On this page
A numeric display bound to a REAL variable that stays empty, while an INTEGER display on the same register shows live data, is not a communication fault. The working integer display proves the link, the slave address and the register offset; what is broken is how the HMI interprets the register pair: the variable type, the word order, or the display format. The case here is a PLC REAL value of 628402.0 in %QW55, carried on Modbus registers 40064 and 40065, with the device double-word order set to Low Word First. Fix it in three moves: declare the HMI variable as a 32-bit float on the register pair, set the device double-word order to Low Word First to match the PLC, and give the numeric field six integer digits so 628402.0 fits.
What the working integer display proves #
Bind two temporary INTEGER displays, one at 40064 and one at 40065, and confirm they track %QW55 and %QW56 in the PLC. When both follow the PLC words, you have proven:
- the Modbus link and the slave address,
- the register offset from the PLC word to the Modbus register number,
- that the PLC server exposes those words as readable holding registers.
If neither register tracks the PLC, stop: the link itself is down, and that is a different fault covered in Fixing HMI Modbus Device No Response Over RS-485. No data-type setting will rescue a dead link.
One caution before you trust any address here: the Modbus register number is not the %QW index. Confirm in the PLC's Modbus server mapping which register carries %QW55, because the mapping, not the notation, is what the HMI reads.
How 628402.0 occupies the two registers #
A REAL travels as a 32-bit IEEE 754 value split across two consecutive 16-bit registers. The decode for this value, with the arithmetic:
- 628402 = 1.0011001011010110010 x 2^19, so the biased exponent is 19 + 127 = 146, which is 10010010 in binary.
- The fraction field is the significand without its leading 1, padded to 23 bits: 00110010110101100100000.
- The full 32-bit pattern is 0 10010010 00110010110101100100000, which groups into the bytes 49 19 6B 20 (hex), or 0x49196B20.
- The high word is 0x4919 = 18713 and the low word is 0x6B20 = 27424.
| PLC word | Modbus register | Content with Low Word First |
|---|---|---|
| %QW55 | 40064 | 27424 (low word) |
| %QW56 | 40065 | 18713 (high word) |
Force 628402.0 into the PLC variable and read both registers as INTEGER. If 40064 shows 27424 and 40065 shows 18713, the PLC places the low word in the lower register and the Low Word First setting matches it. If the two numbers are swapped, the PLC sends High Word First. The integer readings are the deciding evidence, because they are unaffected by word-order interpretation.
A wrong word order does not produce a blank. The same pair assembled backwards, as 0x6B204919, decodes to about 1.9 x 10^26. A display showing an astronomical number for a six-digit process value is a word-order fault, not a format fault.
The source must actually be REAL. A DINT 628402 in the same words (0x000996B2) has a zero exponent field and decodes to a denormal near zero, about 7 x 10^-32, which is the tell-tale that the PLC side, not the HMI side, holds the wrong type.
Define the variable as a 32-bit float on the pair #
- Set the display variable's data type to the 32-bit floating-point type (most editors name it Float or Real), not a 16-bit integer type.
- Bind it to the same Modbus device as the working integers and set its address to the first register of the pair, 40064. The driver consumes 40065 automatically; do not create a second variable there, and do not let another 32-bit variable overlap it.
- Set the device double-word order to Low Word First. The setting is per device, so every 32-bit variable on that device inherits it; check the existing DINT and REAL tags on the same device before changing it.
- Transfer the project, or run the HMI simulator against the live device, so the new variable definition is active.
- Open the variable monitor or online diagnostic: the Real variable must read 628402.0.
If the monitor shows 628402.0, the decode is done and only the display object remains. If it shows a wrong value, return to the word-order test above.
Why the display can still be blank #
The monitor can hold 628402.0 while the numeric object draws nothing. That points at the object, not the link:
- The object is still bound to the old INTEGER variable. Rebind it to the Real variable; if the object refuses the type change, delete and re-add it.
- The format has too few integer digits. 628402.0 needs six integer digits before any decimal places; a narrower format shows overflow marks or nothing. Set a floating or fixed-decimal format with at least six integer digits.
- Min/max limits hide the value. A value outside the object's configured range is not drawn; widen the limits or remove the range.
- The field is physically too small for the digits. Widen the object or reduce the decimals.
The integer test passed earlier because a 16-bit integer format describes raw register content, and 27424 fits any integer format. A float format must fit the converted value, which is why the digit count only becomes a fault after the type change.
Faults that recur on 32-bit register pairs #
- Odd or overlapping pairs: a REAL whose address begins at 40065 reads half of one value and half of the next. Keep every 32-bit variable on its own consecutive, non-overlapping pair.
- Off-by-one addressing: some tools enter 4xxxx notation against zero-based wire register numbers, and the two differ by one. A one-register shift can pass a single-register integer test against a non-zero neighbour while corrupting the REAL; the two-register integer test above exposes it.
- Mixed word orders on one device: the order is a device setting, so a PLC that sends some tags High Word First needs those tags on a second device entry, pointed at the same PLC, with the opposite setting.
- Wrong source type: a REAL variable pointed at a pair the PLC fills with an INT or DINT decodes garbage or a denormal near zero, as above.
- A register that holds a scaled integer rather than an IEEE 754 float needs scaling, not decoding; How to Scale a PLC Integer Into an HMI Display Value covers that path.
- %QW is a word the PLC writes: confirm the server exposes it to the HMI as a readable holding register, and that the HMI display never writes back to it.
Confirm the fix end to end #
- Set the PLC REAL mapped to %QW55/%QW56 to 628402.0 and confirm the online words read 27424 and 18713.
- Confirm the two INTEGER displays show the same two numbers.
- Confirm the Real numeric display shows 628402.0.
- Change the PLC value to -1.5, then to 0.25, and confirm the sign and the fraction display correctly; a half-decoded or byte-swapped result fails this test.
- Cycle power on the PLC and the HMI and confirm the display repopulates with the same value without operator action.
One care point before the station returns to production: a wrong word order can produce a plausible-looking but wrong number, so trust the display only after the two-integer test and the -1.5 and 0.25 checks both pass.
The decision, case by case #
| Symptom | Fault | Action |
|---|---|---|
| INTEGER shows both words, REAL display blank | Variable type or display format | 32-bit float on the pair, six integer digits |
| REAL shows about 1.9 x 10^26 for this value | Word order mismatch | Set the device to Low Word First |
| REAL shows a denormal near 7 x 10^-32 | PLC source is a DINT, not a REAL | Make the PLC variable REAL |
| Neither integer register tracks the PLC | Communication, not data type | Fix the link before touching types |
Questions asked
How do I display a REAL value from a PLC on an HMI numeric display over Modbus?
Declare the HMI variable as the 32-bit floating type (most editors name it Float or Real), bind it to the first register of the pair, and match the device double-word order to the PLC. If the address entry also has a register or word count, it must be 2. Then format the object with six integer digits for 628402.0; a narrower float format blanks the object even when the variable reads correctly in the monitor.
How do I tell whether the word order should be Low Word First or High Word First?
Write a known REAL value, 628402.0, into the PLC and read both registers with temporary INTEGER displays. If the lower address shows 27424 and the next shows 18713, the low word sits in the lower register, so the order is Low Word First and the setting matches. Because the setting is device-wide, change it once on the device and re-check every existing 32-bit tag on that device afterward.
How do I tell a communication fault from a data-type fault when the display is blank?
Bind a temporary INTEGER display to each register of the pair. If both follow the PLC words, the link, slave address and offset are correct and the fault is in the variable type, word order or display format. If neither register moves, the link is down and no data-type setting will fix it. A correct value in the variable monitor with a blank object isolates the fault to the display format or limits.
Can two 32-bit variables share one Modbus register?
No. A REAL occupies two consecutive registers, so a 32-bit variable that begins one register late mixes half of one value with half of the next and decodes nonsense. Keep every 32-bit variable on its own consecutive pair, and never create a second variable on the second register of a pair. An odd base address for a 32-bit variable is the usual sign of this mistake.
Does the double-word order setting apply per tag or per device?
In most HMI drivers it is a device-level setting, so every 32-bit variable on the device, DINTs included, inherits it, and changing it silently reinterprets them all. Verify the existing 32-bit tags before you change it. If a project genuinely needs both orders, point a second device entry at the same PLC and give it the opposite setting for the minority tags.