Troubleshooting
Fixing junk Modbus TCP REAL writes from Citect SCADA
Short answer
The junk is the two 16-bit halves of your 32-bit REAL, assembled in the wrong order. Give each REAL two consecutive holding registers and set the [MODNET]FloatMode parameter - values 0 to 3, default 0, byte order 1 0 3 2 - until the PLC reads back the entered value. The address is usually right; ModScan already matched the PLC arrangement.
On this page
- Why do the holding registers fill with junk when I write one REAL?
- Is the SCADA write going to the right tag and register pair?
- Why does ModScan write the same register correctly?
- What does the MODNET FloatMode parameter do and where is it set?
- Which FloatMode setting delivers 123.456 intact?
- How do I change FloatMode without breaking other REAL tags?
- How do I confirm the PLC kept the written value?
- Questions asked
The junk is not corruption and the address is almost certainly right: one 32-bit REAL always occupies two consecutive 16-bit holding registers, and your SCADA write is assembling those two words in an order the Siemens mapping does not expect. ModScan worked because its arrangement already matched the PLC. The fix is the [MODNET]FloatMode parameter - values 0 to 3, default 0 - set in the MODNET section of the Citect parameters, not a new register address. Work the four checks below in order: binding, register pair, byte order, readback.
Why do the holding registers fill with junk when I write one REAL? #
Because one REAL is 32 bits and one holding register is 16 bits, every floating-point write fills two consecutive registers with the raw halves of the bit pattern, which look like junk when you read them as integers.
An IEEE-754 single-precision REAL splits into a high word and a low word. Read as integers, those words are bit-pattern halves, not the decimal number on the screen, so 16-bit values that look like noise are the normal raw form of a floating-point number.
The adjacent-register behaviour in your symptom matches this exactly. A setpoint of 1.0 encodes as 0x3F800000: the registers receive 16256 and 0, so the second one looks untouched. A setpoint of 100000.0 encodes as 0x47C35000: the registers receive 18371 and 20480, and the neighbour now fills with junk. The configured range 40001 to 40999 does not make each register an independent REAL; allocate two consecutive registers per value, both inside the range.
Is the SCADA write going to the right tag and register pair? #
Check it before touching byte order: a wrong binding or an off-by-one base address delivers a perfectly encoded REAL into the wrong pair of registers, and no FloatMode value repairs that.
Read the tag behind the numeric entry object, not its displayed label:
- Write target: the entry action can write a different tag than the object displays.
- Data type: REAL, so the driver encodes 32 bits rather than one integer register.
- Device and address: which MODNET connection and which 4xxxx reference receives the write.
- Conversion: scaling or code in the entry action can change the value before encoding.
Then check the addressing convention. The 4xxxx notation counts references from 40001, while the protocol request carries an offset counted from 0, so reference 40001 is offset 0. If Citect and ModScan disagree by one register, the whole two-register write shifts and you see one plausible register next to one wrong neighbour. Also check allocation: a second tag whose address is the second word of your REAL corrupts both values whenever either one writes.
Compare the operator entry with the SCADA tag value immediately before transmission. If they differ, fix the entry action or its conversion. A write that never arrives at all - no registers changing - is a different fault: see why a SCADA write to a PLC real address fails silently.
Why does ModScan write the same register correctly? #
Both tools send valid Modbus TCP frames; they differ only in how they arrange the four bytes of the 32-bit value across the two registers, and ModScan arrangement already matches your PLC.
That result narrows the fault to the byte arrangement: the TCP connection, the PLC server, the register range and the two-register write length are all proven. Make the comparison fair before concluding:
- Same device, same starting reference, same value, same quantity of two registers.
- Pick a destination whose wrong values cannot command a running machine - a scratch pair, or the machine in a safe state.
- Record the PLC REAL and both raw words after the ModScan write, then repeat after a SCADA write of the same value.
Driver debugging output or a network capture closes the question: it shows destination, offset, quantity and the data bytes in transmission order, which is exactly what FloatMode changes. If the addresses or quantity differ, fix the mapping first; if they match and only the byte sequence differs, you have a FloatMode problem.
What does the MODNET FloatMode parameter do and where is it set? #
It is the MODNET driver floating-point byte-order setting, held in the Citect parameters under the MODNET section and set through the Computer Setup Editor or the Citect.ini file, with values 0 to 3.
| FloatMode | Documented byte order |
|---|---|
| 0 (default) | 1 0 3 2 |
| 1 | 3 2 1 0 |
| 2 | 0 1 2 3 |
| 3 | 2 3 0 1 |
The digits are the driver labels for the four bytes of the 32-bit value - they are not register numbers. Those four orders are the four combinations of which register holds which word and which byte leads inside each register, so whatever arrangement your PLC mapping expects, exactly one setting produces it. The serial Modbus driver carries the same role parameter as [MODBUS]FloatMode in its own section.
Set it where the MODNET driver parameters live: in the Computer Setup Editor, add the section MODNET and the parameter FloatMode, or edit the Citect.ini file directly. The wider MODNET equipment and port configuration is covered in connecting Citect SCADA to a Modbus RTU gateway over MODNET.
Which FloatMode setting delivers 123.456 intact? #
Enter 123.456, watch the two registers, and set the mode that makes them read 17142 and 59768: the four settings produce the four possible arrangements, so you identify the right one within four test writes.
Pick a test value whose four bytes all differ, or a rearrangement can hide. 123.456 encodes in IEEE-754 single precision as 0x42F6E978 - sign 0, exponent 133, the remainder mantissa. The 32 bits split into a high word 0x42F6 and a low word 0xE978:
- 0x42F6 = 4x4096 + 2x256 + 15x16 + 6 = 17142
- 0xE978 = 14x4096 + 9x256 + 7x16 + 8 = 59768
With the arrangement the PLC expects, writing 123.456 puts 17142 in the first register and 59768 in the second, and the watched REAL shows 123.456. The other three arrangements shuffle those bytes:
| Registers show (first, second) | What is swapped | Action |
|---|---|---|
| 17142 and 59768 | Nothing - arrangement matches | If the REAL still reads wrong, the fault is in the PLC mapping or a competing writer, not byte order |
| 59768 and 17142 | Word order | Change FloatMode and retest |
| 63042 and 30953 | Bytes inside each word | Change FloatMode and retest |
| 30953 and 63042 | Both | Change FloatMode and retest |
The decision: run the reference write from ModScan, note the pair it produced while the REAL read 123.456, then step Citect through FloatMode 1, 2 and 3 from the default, writing 123.456 after each change, and stop at the first pair that matches ModScan - at most three changes. One documented installation reading 32-bit floats from a PM710 power meter needed FloatMode = 1, plus a one-register address-base correction, before values read correctly, which makes 1 the first candidate to try, not a rule for every device. Leave the address alone: ModScan already proved it. And change either the driver setting or the PLC logic, never both.
How do I change FloatMode without breaking other REAL tags? #
Treat it as a driver-wide change: [MODNET]FloatMode reorders every floating-point value the MODNET driver handles, so record the current setting, audit the other REAL tags, and retest more than the one tag you are fixing.
- Record the current FloatMode value, and each REAL tag address, data type and PLC register pair.
- List every REAL tag on the same MODNET driver - the new byte order applies to all of them together.
- Correct any binding, address-base or overlap error found earlier: two consecutive registers per REAL, both inside the mapped range, no tag starting on another tag second word.
- Set the FloatMode value the test identified and load the change the way your installed Citect version documents.
- Repeat the controlled write of 123.456 while watching the REAL, both words and the neighbouring variables.
- Remove any PLC-side swap logic you added while diagnosing, so exactly one conversion point remains.
How do I confirm the PLC kept the written value? #
Read the destination in the PLC, not on the screen: an entry object echoes the submitted number until the next readback overwrites it, so only the watched REAL and its two raw words prove the write landed.
Test three values: the fractional 123.456, a negative value if the application permits one (its sign bit makes the high word read as a large unsigned integer), and a large value inside the allowed range. Then watch for drift: if the REAL is correct immediately after the write and changes seconds later, PLC logic rather than the driver is writing the same pair, and that tag needs its own non-overlapping registers.
Questions asked
Does the MODNET FloatMode parameter affect integer tags on the same driver?
No. The parameter governs how floating-point values are arranged; a 16-bit integer tag still travels as one register in the standard order. After changing the setting, re-verify your REAL tags - the integer tags need no retest.
Is there an equivalent setting for the serial Modbus driver?
Yes. The serial driver carries the same role parameter as [MODBUS]FloatMode, in its own section, and it changes how floating-point values are transmitted and received. A Modbus RTU link through a gateway shows the same junk-register symptom and responds to the same fix.
Can I fix the byte order in the PLC instead of in Citect?
You can - swap the two words, or the bytes inside them, in PLC code - but keep exactly one conversion point. FloatMode is a single driver-wide parameter, so prefer it over per-tag swap logic, and never run both: a driver reorder plus a PLC swap re-creates the mismatch you started with.
Will a wrong FloatMode raise a Modbus exception?
No. The request still carries two valid 16-bit registers at a legal address, so the PLC accepts it and answers normally - only the assembled REAL is wrong. That is why this failure appears as junk data instead of a communications alarm, and why driver debugging or a capture is the way to see it.