IMDHMIControls LibraryShop main store

Troubleshooting

Why Citect Modbus TCP block reads fail and MaxBits caps them

SCADA and data logging Published 7 min read By IMDHMI controls team

Short answer

Citect MODNET combined every configured variable into one function 03 request for 122 consecutive registers, a block the meter behind the Modbus RTU gateway never answered, so polling restarted at the availability check. Setting MaxBits to 64 bits in that device's citect.ini driver-instance section bounded the block size; the driver then issued one request per variable and reads recovered.

On this page
  1. What the capture shows
  2. Why Citect asks for 122 registers
  3. Checks before changing the driver
  4. Setting MaxBits in citect.ini
  5. Verifying the fix
  6. The decision for each case
  7. Questions asked

Citect was not reading one voltage register; it was asking the gateway for every configured variable at once. On a v7.40 SP2 project polling an ASTec PRO380-Mod power meter through an MGate MB3170 Modbus RTU gateway, the MODNET driver combined all configured variables into one Modbus TCP function 03 request covering 122 consecutive registers. The meter never answered a block that size, so the driver timed out and restarted its sequence at the availability check, over and over. The fix is a driver grouping limit, not a register change and not a byte-order change: set MaxBits to 64 bits in that device's own citect.ini driver-instance section, and the driver then issued one request per variable and polling recovered.

What the capture shows #

Two exchanges tell the whole story: a short availability check that succeeds, then one oversized process read that never comes back.

Step Bytes on the wire Decode
Availability check 02 03 10 20 00 01 81 33 Unit 02, function 03, start address 0x1020 (4128), quantity 1
Availability response 02 03 02 25 80 E7 74 One register returned: 0x2580, which is 9600 decimal, the meter's serial rate value
First process read 02 03 20 08 00 7A 4E 18 Unit 02, function 03, start address 0x2008 (8200), quantity 0x007A (122 registers)
Aftermath duplicate ACK, keep-alive ACK, RST Consequences of the unanswered request, not its cause

The availability exchange proves the path is sound: the same gateway, serial channel and unit address carry a request and return a valid value. The only thing that changes for the failing read is the quantity, and nothing comes back. After its timeout, Citect's polling sequence restarts at the availability register and the cycle repeats.

Mind which side produced each trace. These octet strings carry a unit address and a trailing CRC, so they are RTU-style frames, which is what MGate Manager shows on the gateway's serial side. A native Modbus TCP frame instead carries its routing in the MBAP header and appends no CRC, which is what Wireshark shows on the Ethernet side. Confirm the capture plane before comparing byte positions.

Why Citect asks for 122 registers #

MODNET optimizes polling by combining configured variables into block reads. The first configured variable, voltage phase 1, is one REAL and needs only 2 registers. The driver was not sizing the request around that variable; it was grouping the whole acquisition block for the device into one function 03 read, and all the configured variables together pushed the quantity to 0x007A.

Worked example. Decode the quantity from the capture: 0x007A = 7 × 16 + 10 = 122 registers. A full response would carry 2 data bytes per register, so 2 × 122 = 244 data bytes, plus 1 byte of function code and 1 byte of byte count: a 246-byte PDU, and 253 bytes on the Ethernet side once the 7-byte MBAP header is added. That request is legal Modbus TCP. The specification caps one read of holding registers at 125 registers, and 122 sits under that ceiling; the driver's own documented grouping ceiling of 2000 bits is the same protocol limit expressed in bits, 125 × 16 = 2000. Nothing about the request broke a rule. The serial device behind the gateway simply does not answer blocks that long, and serial devices commonly accept far shorter blocks.

This is not a FloatMode fault. FloatMode = 1 governs how the driver decodes a multi-register REAL after a response arrives; it cannot explain a request that never receives one. Byte-order trouble looks different in the capture: values arrive, then decode to nonsense. If your symptom is junk values on live registers rather than dead polls, work through fixing junk Modbus TCP REAL writes from Citect SCADA instead of touching MaxBits.

The independent Modbus poller that ran fine in parallel asked for one variable at a time and never exercised the aggregated block. That result is the discriminator, not the cable, the gateway or the meter: short reads work on this path, and the specific block length is what fails.

Checks before changing the driver #

Run these against data already in the capture, so the INI edit fixes the right thing:

  • Same path for both reads: the working availability read and the failing block read traverse the same gateway, serial channel and unit address. A good availability read rules out cable, routing and addressing faults; it does not prove the device accepts every block length.
  • Unit address: the request carries unit 02, and the meter's configured address must match it.
  • Serial settings: the availability value should equal the rate configured on the gateway's serial channel for this meter. Read parity, data bits and stop bits from both ends as well; they were not captured in this case.
  • Request dimensions: compare the failing request's start address and quantity against the working poller's request for the same variable. Both fields must match before the two tools' results mean anything.
  • Addressing convention: confirm the capture decodes to the register you intended, after accounting for the driver's addressing convention.
  • Retry timing: measure the gap between the unanswered request and the restart at the availability register, and compare it with the driver's configured timeouts. No timing value is established by this case, so take the number from your own trace.

The gateway's TCP endpoint and serial side deserve their own pass; connecting Citect SCADA to a Modbus RTU gateway over MODNET walks through that setup check by check.

Setting MaxBits in citect.ini #

  1. Quiesce the affected polling path first: stop the runtime or place the I/O in a maintenance state, so the configuration file is not rewritten or reloaded under your edit. That pause also keeps field writes from dying mid-change.
  2. Find the device's own driver-instance settings in citect.ini. In this project the section carried the device label MODNET.PORT74_BOARD1.ASTec and already held the availability-check settings: FloatMode = 1, InitVar = 4128, InitVarType = 3. Those are correct; leave them alone.
  3. Add MaxBits = 64 in that same scope, following the INI syntax already in use rather than creating a second, similarly named section:
MODNET.PORT74_BOARD1.ASTec
FloatMode = 1
InitVar = 4128
InitVarType = 3
MaxBits = 64

The label above shows where the values belong in this project; it is not a replacement template for a section you do not already have. 4. Reload the driver or restart the runtime component your project requires, so the new value is actually read at startup.

MaxBits bounds the bits the driver may combine into one request. It is a grouping limit, not a register address, not a word count and not the width of your data type. The arithmetic at the value used here: 64 bits divided by 16 bits per register gives 4 registers per grouped read, room for two REALs. The observed outcome was one request per variable; in another project, adjacent variables can still group within the limit, and a REAL remains 2 registers whatever the limit is.

Scope decides whether the fix takes. Driver documentation describes MaxBits among the MODNET driver parameters, and in this project the working placement was alongside the device's other MODNET settings in its driver-instance section. The most common silent failure is scope: the parameter entered under a global or different-port scope leaves the active device's settings untouched, and the next capture shows the same oversized quantity. Whichever scope your installed version uses, verify by capture.

Verifying the fix #

  • Start a fresh capture on the Ethernet side and, where available, on the gateway's serial side. Keep it separate from the old trace so earlier retransmissions are not mistaken for post-change traffic.
  • The availability check still returns its one-register value.
  • The function 03 read covering the voltage register no longer shows quantity 0x007A; each request now carries a quantity bounded by the new limit.
  • Screen values agree with the independent poller's readings for the same registers.

The decision for each case #

  • Block read the path never answers — polls time out, the sequence restarts at the availability register, duplicate ACKs and resets trail behind: cap the grouping. Set MaxBits = 64 in that device's driver-instance scope, then raise it only to a block length the serial device demonstrably answers, never past the driver's documented ceiling.
  • Block read answered, but values decode wrong: grouping is healthy and MaxBits is not your problem. That is byte or word order in multi-register data; fix the float interpretation, not the block size.
  • Native Modbus TCP device that answers the aggregate block without complaint: leave the grouping alone. There is nothing to fix, and lowering it would only add requests.
  • Dead polls even on single-register reads: the fault sits downstream of block size. Work the path checks above — endpoint, unit address, serial settings — before touching any driver parameter.

Questions asked

Is there a hard limit on how many registers one Modbus read can ask for?

The Modbus specification allows at most 125 holding registers in one read, entered as 0x007D in the quantity field, because the response must fit a 253-byte PDU: 2 data bytes per register plus the function code and the byte count. Reads of coils have their own larger limit of 2000 coils per request. A 122-register read breaks no protocol rule, so when it goes unanswered behind a serial gateway, the binding limit lives in the serial device or the gateway path, not in Modbus TCP.

How high can the MaxBits setting go?

The documented ceiling is 2000 bits, and the driver does not group a request larger than that. The number is not arbitrary: 125 registers times 16 bits per register comes to exactly that many bits, so the driver's maximum matches the Modbus protocol ceiling for a single read. Any lower value is allowed, and a much lower value is exactly what a serial device that chokes on long blocks needs.

What do the duplicate ACK, keep-alive and reset packets mean?

They arrive after the oversized request dies, so treat them as consequences of the failed exchange rather than a network fault of their own. Chasing TCP tuning, keep-alive intervals or switch settings before the request size is fixed sends the diagnosis down the wrong road. Bound the block size first, capture again, and expect those packets to disappear once every request gets an answer.

Does MaxBits change anything inside the meter?

No. It bounds only how the driver groups configured variables into requests. The register map, the addressing convention, the data types and the serial settings in the device all stay as they are, and the availability register is polled the same way as before. If a read now returns data that decodes to the wrong engineering value, the grouping limit has done its job and the remaining fault is interpretation, meaning byte or word order in multi-register values.

Keep reading

  • How-to

    Connecting Citect SCADA to a Modbus RTU gateway over MODNET

    Yes — MODNET is Citect's driver for Modbus over TCP/IP, and a true RTU-to-TCP converter presents standard Modbus TCP on its Ethernet side, so the combination works. Success then rides on two things: the gateway's operating mode, and carrying the RTU slave address and register offsets into Citect correctly, proved by reading one register whose value you can see at the device.

    SCADA and data logging

  • Troubleshooting

    Fixing junk Modbus TCP REAL writes from Citect SCADA

    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.

    SCADA and data logging

  • Troubleshooting

    Fixing Machine SCADA Expert Modbus TCP reads to a TM221

    Matching IP and port do not prove the read path is right: with MOTCP selected, Machine SCADA Expert must use that driver's station and address syntax, and the number after 4X must resolve to MW0. Rebuild the station and I/O address from the MOTCP manual example, then prove it with known values in MW0 and MW1: the wrong convention reads MW1, exactly one register off.

    SCADA and data logging