Siemens LOGO! 8 Modbus RTU Float: Troubleshooting Byte Order

David Krause15 min read
ModbusSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Description

A Siemens LOGO! 8 (firmware class V8.x) is acting as a Modbus TCP client to a load-cell weight indicator exposed through a USR-DR302 RTU-to-TCP gateway. The PLC establishes the TCP session and reads 32-bit floating-point weight data, but the displayed value is unusable: it oscillates between -9,999,999 and 9,999,999, and even when the raw payload stabilises, the value drifts by 1 to 4 grams against the indicator's local display. A second test using a generic OPC server (e.g., KEPServerEX/Modbus Poll class) on the same gateway returns the correct kilogram value, but only after enabling a byte-permutation (word-swap) mode in the OPC driver. The OPC test confirms three constraints simultaneously: the field wiring is good, the RTU/TCP gateway is functional, and the data on the wire is a 4-byte IEEE-754 float transmitted in non-standard byte order.

LOGO! 8 has no native 32-bit float handling on its Modbus client/server interface, no byte-swap function block, and no scaling register for analog inputs read from Modbus. Once the OPC driver is removed and LOGO! becomes the only master, the value can no longer be corrected downstream. This article documents the byte-order diagnostic, the 16-bit F/I converter limit, and the only two workable engineering paths: (a) coerce the indicator to a 16-bit scaled-integer register map, or (b) install a LOGO! CIM (Communication Interface Module) and let LOGO! act as a Modbus RTU master where limited 32-bit handling is supported through the network analog input function block.

System Topology and Hardware

The physical layer is a 4-wire (or 2-wire with ground return) RS-485 segment between the weight indicator's Modbus RTU terminal block and the USR-DR302. The gateway is configured as a Modbus RTU slave on the RS-485 side and a Modbus TCP server on the Ethernet side. The LOGO! 8 base module (e.g., 6ED1052-1MD08-0BA2 or 6ED1052-1CC08-0BA2) sits on the Ethernet side as a Modbus TCP client. The LOGO! 8 is parameterised in LOGO! Soft Comfort V8.x under Tools → Ethernet Connections → Modbus Connections, with the IP/port of the USR-DR302 and the target unit identifier (typically 1, matching the indicator's slave address).

Load Cell 4-wire / 6-wire Weight Indicator Modbus RTU slave USR-DR302 RTU ↔ TCP LOGO! 8 Base Modbus TCP client mV/V RS-485 Modbus RTU Ethernet Modbus TCP

Figure 1 — System topology: indicator on RS-485 RTU, USR-DR302 bridging to TCP, LOGO! 8 as TCP master.

Root Cause 1 — Byte-Order (Endianness) Mismatch

IEEE-754 single-precision occupies four bytes. Modbus transmits them in 16-bit register pairs. The default Modbus order, Big Endian, lays the bytes out as ABCD (most significant byte first). Many low-cost Chinese weight indicators (and a long tail of instruments from major vendors) ship with non-IEEE byte ordering: most commonly CDAB (word swap), DCBA (full byte reversal), or BADC (byte swap within each word). The OPC server in this case resolved the issue with a permutation setting, confirming the indicator is not ABCD.

LOGO! 8 has no byte-swap function block on its Modbus client. The Network Input/Output blocks (NI/NA) read 16-bit words only; combining two consecutive words into a 32-bit float requires the Analog Input function block with type "Word" or "DWord" depending on firmware, and even then, no permutation is applied. Whatever order the slave sends is what LOGO! records. If the slave is CDAB, LOGO! reads a corrupted mantissa/exponent and the resulting "value" can land anywhere in the 32-bit float range — explaining the -9,999,999 / 9,999,999 swing observed in the field.

Slave byte order Wire sequence (msb→lsb) Typical source LOGO! outcome
ABCD (Big Endian, IEEE) B3 B2 B1 B0 Standard Modbus spec Correct float, 1:1
CDAB (word swap) B1 B0 B3 B2 Many Asian indicators, some Siemens S7 patterns Corrupted float, swings ±1e7
DCBA (Little Endian) B0 B1 B2 B3 Some PC/Windows-flavoured devices Corrupted float, biased to zero
BADC (byte swap) B2 B3 B0 B1 Mid-endian, PDP-11 heritage Corrupted float, sign-flip
Diagnostic — capture the raw register pair. In LOGO! Soft Comfort online test, set the Network Input to read holding registers 0x0000 and 0x0001. Open the "Data Table" view and log NI word 0 and NI word 1. If the indicator shows 12.123 kg and the OPC server returns float 12.123, the wire pattern that produces that float is your true byte order. Compare against LOGO!'s interpretation to confirm a swap.

Root Cause 2 — LOGO! 16-Bit Integer Output Limit

LOGO! 8 arithmetic and HMI display only work on 16-bit signed integers (range -32,768 to 32,767). Even if the float is correctly read, the F/I (Float to Integer) function block in the analog toolset outputs a 16-bit integer with a configurable resolution (e.g., 0.001, 0.01, 1.000). When the application demands 1-gram resolution, the integer at the output of F/I carries grams directly, capping the readable range at 32.767 kg. The observed field drift (1000 g → 999 g; 1235 g → 1231 g; 2412 g → 2408 g) is the result of truncated bits in the IEEE mantissa after the float passes through LOGO!'s scaled-integer pipeline, not a calibration error in the indicator.

Indicator reading (kg.g) Ideal integer (g) LOGO! F/I output (g, observed) Error (g)
0.557 557 554 -3
1.000 1000 999 -1
1.235 1235 1231 -4
2.000 2000 1999 -1
2.412 2412 2408 -4
3.086 3086 3078 -8

The error grows monotonically with payload because F/I truncation simply drops the least significant bits of the IEEE mantissa. There is no rounding option in the F/I block; the discarded bits are not recovered downstream. The 1-gram-per-kilogram slope of the error is the signature of mantissa truncation in a 16-bit pipeline.

Solution Path A — Re-Map the Indicator to a 16-bit Integer Register

This is the engineering-canonical path. Eliminate the float entirely by reconfiguring the weight indicator to expose a 16-bit scaled-integer holding register whose unit is grams (or deci-kilograms if your application tolerates 100 g resolution). Most indicators support this on a per-parameter basis: a "net weight" integer register with explicit scale (1 count = 1 g, 10 g, 100 g, or 1 kg). Once the indicator emits Big Endian, ABCD, 16-bit signed grams, LOGO! reads the value with a single Network Input word and zero conversion error.

  1. Enter the indicator's configuration menu (often password-protected, default 0000 or 888888 depending on vendor).
  2. Set the Modbus communication parameters to match the gateway: baud 9600 or 19200, 8N1, slave ID 1.
  3. Select the "data format" or "register map" parameter. Change from "Float" to "Integer" or "Long" depending on menu wording. Where the vendor offers a unit choice, set it to kg × 1000 (i.e., grams).
  4. Verify the byte order in the indicator's serial protocol setup. Force it to Big Endian (AB) if the option exists. If the option is missing, document the actual order and write it into the project file.
  5. Read holding register 0 (or the address documented for net-weight-integer) with LOGO!'s Network Input block. Tie that word directly to a marker, an analog amplifier, and the HMI text field. No F/I block is needed; the value is already integer grams.

This path caps the display at 32.767 kg. For a 15 kg platform, the indicator's range must be scaled so that 15,000 fits in 32,767 — i.e., 1 count = 1 g works, but 1 count = 0.1 g would not (max becomes 3.2767 kg). If the platform exceeds 32 kg, use 1 count = 10 g and accept 10 g resolution, or split the range into two indicators and sum, or move to Path B.

Solution Path B — LOGO! CIM (Communication Interface Module)

The LOGO! CIM Modbus RTU communication application adds a true RS-485 Modbus RTU master port to a LOGO! 8 base module. The CIM connects to the right-hand expansion bus of the LOGO! 8 base, presents itself in LOGO! Soft Comfort as additional network nodes, and lets the LOGO! read 32-bit register pairs more reliably than a third-party TCP gateway can. The CIM is the recommended interface for any application where LOGO! must poll a Modbus RTU slave directly without a gateway in the middle.

When the CIM is fitted, the application changes in two ways: the USR-DR302 is removed from the topology, and the indicator is wired RS-485 directly to the CIM terminals (A, B, GND). The CIM exposes the Modbus registers through the same Network Input/Output mechanism, but byte-order handling for standard 32-bit float slaves is then handled by LOGO!'s analog input with a 32-bit data type (firmware 8.2 onward), and the F/I block downstream is bypassed for direct integer scaling. The CIM is documented to support register polling at 1,200 to 115,200 baud with 7/8 data bits and standard parity options, with slave IDs 1 to 247.

Weight Indicator Modbus RTU slave LOGO! CIM RTU master, RS-485 LOGO! 8 Base Expansion bus A/B/GND expansion RS-485 bus, 2-wire + GND, 120 Ω terminator at each end No external gateway required. Indicator slave address = 1, baud = 19200 8N1.

Figure 2 — CIM-based topology: RS-485 terminated at both ends, CIM as the master, LOGO! base in slot 0.

Field practice. If you must keep the USR-DR302 in the loop, the CIM is not a viable replacement for the gateway; the CIM and the gateway occupy different topology positions. The CIM is a drop-in only when LOGO! is the only master on the RS-485 segment and the gateway is removed.

Step-by-Step Commissioning (Path A)

  1. Set the indicator's Modbus parameters: baud 19200, parity None, data bits 8, stop bits 1, slave ID = 1. Cycle power.
  2. In the indicator's data-format menu, switch the net-weight register from "Float (32-bit)" to "Long/Integer (32-bit)" or "Integer (16-bit)" per available options. The unit scaling must produce integer counts equal to grams. Verify by placing a 1.000 kg test mass and reading the raw register; the value should be 1000, not 1000.000.
  3. Configure the USR-DR302 as Modbus RTU slave on the RS-485 side and Modbus TCP server on the Ethernet side, port 502, IP static. Set the "register mapping" so that the indicator's integer weight register appears at TCP holding register 0.
  4. In LOGO! Soft Comfort, open Tools → Ethernet Connections → Modbus Connections. Add a connection: client = LOGO!, server IP = USR-DR302, server port = 502, slave/unit = 1. Mark it as "Read holding registers from 0, length 1".
  5. Drop a Network Input (NI) block into the program. Wire it to the Modbus connection, register 0, 16-bit. The output is now an integer in grams.
  6. Drop an Analog Amplifier (or use the message text block's "Bar/Value" scaling). Configure it as 1:1 if the NI output is already in grams, or set a scale factor if the indicator outputs kilograms (multiply by 1000).
  7. Drive the LOGO! display or an external HMI with the amplifier output. Confirm sign and decimal placement.
  8. Apply 0 g, 1.000 kg, and 2.500 kg test masses. Verify integer equality at each step before signing off the IO test.

Verification Procedure

Build a four-point calibration check on the live system, not just on the bench. Use certified test masses, not hand-loaded objects. Capture the LOGO! display, the indicator's local display, and the OPC log (if still present) at each point.

Test mass Expected (g) Acceptable LOGO! reading Failure mode to investigate
0 g (tare) 0 0 ± 1 g Offset / tare not applied
1.000 kg 1000 1000 ± 1 g Byte swap, sign flip, scale factor wrong
5.000 kg 5000 5000 ± 1 g Slope error from F/I truncation
15.000 kg (or platform max) 15000 15000 ± 1 g 16-bit overflow > 32.767 kg
Watch for the -32,768 wrap. If the indicator sends a negative value (e.g., a tare-reset state) and the LOGO! word is interpreted as a signed 16-bit integer, the value will flip from -1 g to 32,767 g. Configure the Network Input as "unsigned" in the connection settings if your application permits, or apply a saturating clamp with an analog threshold block at 0 g and 32,767 g.

Troubleshooting Matrix

Observed symptom Most likely cause Diagnostic action Resolution
Value oscillates ± 9,999,999 Byte-order mismatch (CDAB/DCBA/BADC on the wire) Capture two raw NI words; decode both as ABCD and CDAB, compare to OPC truth Re-map indicator to integer register, or change indicator's byte-order setting if available
Sign is inverted (positive mass reads negative) Sign bit in wrong byte position (BADC) Read NI word 0; if MSB (bit 15) is set when the value is negative, suspect full swap Switch indicator to integer format with ABCD ordering
Constant zero despite valid OPC traffic Function code 0x03 vs 0x04 mismatch, or wrong register base Confirm whether the indicator uses Input Registers (0x04) or Holding Registers (0x03); LOGO! only supports 0x03 on its standard Modbus client Reconfigure the USR-DR302 to map input registers to holding registers, or use CIM Path B
Value reads as 32,767 g constant 16-bit integer saturation Check if mass > 32.767 kg; check if the Network Input is signed and value is -1 Reduce scale to 1 count = 10 g or 100 g, or use a 32-bit capable interface (CIM)
Stable but offset by 1-4 g, drift grows with mass Float truncation through 16-bit F/I block Compare the integer count before F/I (use a parallel OPC client) to the count after F/I Eliminate the F/I block by reading an integer register directly from the indicator
Communication timeout on first poll TCP keepalive / gateway socket closure Wireshark the TCP session; look for FIN/RST after 30-60 s of idle Set USR-DR302 to "long connection" mode, or poll ≥ 1 s continuously from LOGO!
Intermittent CRC errors on RS-485 Missing termination or wrong A/B polarity Place 120 Ω between A and B at both cable ends; swap A and B at the indicator Verify A is the non-inverting (D+) line at every node, B is the inverting (D-) line

Edge Cases and Field-Proven Caveats

Indicator output in kg.g (e.g., 15.487). If the indicator encodes the weight as a fixed-point integer with an implied 3-decimal shift but the LOGO! side assumes 1 count = 1 kg, the displayed value will be 15,487 kg — an apparent "gain" error of 1000×. The Analog Amplifier's gain and offset parameters are the only place in LOGO! Soft Comfort to fix this; multiply by 0.001 and the value displays as 15.487. Always verify the indicator's protocol manual for the unit of each register before writing the gain.

Tare / zero state. A tare of -0.500 kg with a 1.000 kg mass should read 0.500 kg, not 1.500 kg. If the LOGO! always reads gross weight, the indicator's tare is not reaching the LOGO! and the apparent drift is actually the cumulative difference between gross and net. Switch the indicator to a net-weight register (commonly address 5 or 7 depending on vendor) before diagnosing the byte order further.

Multi-slave RS-485 segments. If more than one Modbus RTU device shares the segment, the USR-DR302 must be the only Modbus TCP server; the indicator remains slave ID 1 and any other device is slave ID 2, etc. The LOGO! must issue two separate Modbus connections, one per slave ID, and the gateway's slave-ID routing must be enabled. Most USR-DR302 firmware versions support this only on the "Modbus RTU ↔ Modbus TCP" mode, not on the transparent serial-tunnel mode.

LOGO! Soft Comfort simulation. The simulation does not talk to real Modbus slaves. Test the byte-order assumption in the simulation by manually setting the Data Table values to a known 16-bit pattern (e.g., 0x41C1FFFF for 24.1249f) and confirming the F/I output. Then verify the same pattern on the live system. This isolates the byte-order question from the network question.

Standards and References

Field implementation must comply with the Modbus Application Protocol specification for register addressing and function codes, and with the TIA-485-A electrical layer for the RS-485 segment. The Modbus organization publishes the current protocol specification; consult it for the exact byte ordering of 32-bit values and the recommended function codes. The Siemens support article linked below documents the LOGO! CIM's Modbus RTU master capability as used in the LOGO! V8 ecosystem.

FAQ

Does LOGO! 8 support 32-bit IEEE-754 float values from a Modbus slave?

No. The Network Input/Output blocks read 16-bit words only. The only native path for 32-bit values is via the analog input with 32-bit data type on LOGO! CIM (firmware 8.2 and later) or by reconfiguring the slave to expose a 16-bit scaled integer. Reading two 16-bit words and reinterpreting them as a float in ladder logic is not supported.

How do I swap the byte order of a 32-bit float inside LOGO! 8?

You cannot. There is no byte-swap, word-swap, or endian-conversion function block in LOGO! Soft Comfort. The byte order is fixed at the point of acquisition. If the slave sends CDAB and LOGO! expects ABCD, the only fix is to reconfigure the slave to send ABCD, or to replace the slave with one that does. The USR-DR302 gateway has no byte-permutation function either.

Why does my weight value drift by 1-4 grams against the indicator display?

Because the indicator transmits a 32-bit float and LOGO! truncates it to 16 bits in the F/I block. The error is roughly 1 gram per kilogram of payload. Switch the indicator to an integer register (1 count = 1 g) and connect it with a single Network Input; the drift disappears.

What is the maximum weight I can read with LOGO! 8 at 1 g resolution?

32.767 kg. Above that, the 16-bit signed integer overflows. For higher capacities, scale the indicator to 1 count = 10 g (max 327.67 kg at 10 g resolution) or 1 count = 100 g (max 3,276.7 kg at 100 g resolution), or use a 32-bit capable path through the LOGO! CIM module.

Can I keep the USR-DR302 and add the LOGO! CIM at the same time?

Yes, but the two serve different buses. The CIM is an RTU master on its own RS-485 port; the USR-DR302 is a TCP-to-RTU gateway on the Ethernet port. They can coexist only if the indicator is wired to the CIM port and a different Modbus TCP slave is on the USR-DR302 segment. If the goal is direct indicator access from LOGO!, the CIM replaces the gateway, it does not augment it.

Back to blog