← Articles
Modbus/11 min read/— views

The Modbus Gap-Tolerance Break-Even Is About 10 Registers, Not 50

Bridging a Modbus register gap pays below about 10 unused registers on serial RTU and not above it. Where the 125-register ceiling comes from, and why a hole mid-block may return zeros instead of exception 02.

ModbusSCADANetworkingTroubleshooting

Why block reads matter

A 400-tag Modbus map that times out on every third scan is usually not a slow PLC — it is a driver issuing 400 separate one-register reads when it could issue five. Modbus has no subscription model. The SCADA driver must poll, and every poll is a request and a response on the wire. A map with 400 tags read one register at a time is 400 transactions per scan. The same 400 tags read as a few contiguous blocks may be four or five transactions. The data is identical; the load on the PLC, the gateway, and the serial line is not.

The gap between those two is measurable, not rhetorical. At 19200 baud, 125 registers read in one FC 03 transaction is about 155 ms of airtime. The same 125 registers read one at a time is about 1.58 s — a factor of ten, before the PLC's own turnaround delay is counted. The arithmetic behind both numbers is below.

Poll block optimization is the work of deciding which registers get read together in one function-code request. Done well, scan times drop and timeouts disappear. Done blindly, you either overload a slow device with hundreds of tiny requests or read large useless spans of registers the SCADA never displays.

This is separate from poll rate and timeout tuning. You can have correct timeouts and still have a slow, inefficient map because the driver is issuing one request per tag.

How a driver decides blocks

Most SCADA Modbus drivers build blocks automatically from the tag addresses you configure. The typical rules are:

  • Registers are grouped by function code and address range (holding registers, input registers, coils, discrete inputs are separate spaces).
  • Adjacent or near-adjacent addresses in the same space are merged into one request.
  • The driver splits a group when it crosses the maximum register count for one request.
  • A large address gap between tags breaks the group into two requests.

The knobs you usually get are maximum block size (how many registers per request) and gap tolerance (how many unused registers the driver will read to keep two tags in the same block). Understanding these two settings explains almost all block behavior.

The gap trade-off has a break-even, and it is smaller than you think

Reading across a gap is a trade. If tag A is at register 100 and tag B is at register 140, the driver can either issue two small requests, or one request for 100 through 140 — reading 39 registers you do not use.

On serial RTU that trade is arithmetic, so work it out instead of guessing. MODBUS over Serial Line V1.02 §2.5.1 fixes the RTU default framing at 8E1, 11 bits per character, and §2.5.1.1 sets the inter-frame silent interval t3.5 at 3.5 character times for baud rates up to 19200. At 19200 that is 572.9 µs per character and 2.005 ms per silent interval.

Merging two requests into one saves exactly 13 bytes of framing — the 8-byte request ADU (slave address, function code, start address, quantity, CRC) and the 5 fixed bytes of a response (slave address, function code, byte count, CRC) — plus the two t3.5 intervals that framed that transaction. At 19200 that is 7.45 ms of bytes and 4.01 ms of silence: 11.46 ms saved per request eliminated.

Bridging the gap costs 2 bytes per register, or 1.146 ms each. Divide one by the other and the break-even is about 10 unused registers. Below that, merge. Above it, two requests are genuinely cheaper on the wire.

Both sides of that division scale with character time, so the ten-register answer holds at 9600 and 4800 too, not only at 19200. What does move it is device turnaround. If the slave takes 10 ms to answer, each eliminated transaction saves that 10 ms as well, and the break-even rises to roughly 19 registers. Measure your device's response delay before trusting either figure.

Which is why the common advice to set gap tolerance at 40–50 registers is wrong for serial RTU and right for Modbus TCP. On TCP the payload bytes are free at 100 Mbit and the real cost of a transaction is the round trip plus the PLC's turnaround, typically 2–20 ms, against which 200 extra payload bytes do not register. Bridging a 100-register gap on TCP is usually a win. Bridging the same gap at 19200 baud costs about 103 ms of net airtime every scan.

A hole in the middle may not raise an exception at all

That is the arithmetic. The failure mode is worse than the arithmetic, and it is the reason to keep gap tolerance tight even where the airtime would allow more.

A single unmapped address inside an otherwise valid block can make the whole block fail, and every tag in the block goes bad-quality together. Bulk reads succeed or fail as a unit.

Be careful about why, because the spec and real devices disagree here. MODBUS Application Protocol V1.1b3 §6.3 defines the FC 03 check as a range test on the ends only: the server returns exception code 02, ILLEGAL DATA ADDRESS (§7), when the starting address is invalid, or when starting address plus quantity runs past the end of its register range. A hole in the middle of an otherwise in-range span is not covered by that test, and implementations split on it. Some return 02 anyway. Some return zeros for the unmapped words. Some return whatever was last in the response buffer.

The zero-returning case is the dangerous one. No exception, no bad quality, no alarm — just a plausible 0 delivered to the operator for a tag that was never read. Confirm what your device does with an unmapped word inside a valid span before you let a driver bridge into one. Do not assume you will get the exception.

Practical grouping rules

  1. Lay out the register map so tags read together are contiguous. Optimization at the driver cannot fix a map scattered across the address space.
  2. Keep fast tags and slow tags in different blocks. If one alarm word needs 250 ms polling and 300 trend tags are fine at 5 seconds, do not let the driver merge them into one large fast block.
  3. Do not span gaps that cross into unmapped or reserved registers. Confirm with the device documentation, not assumption.
  4. Respect the real request limit, which is per function code and not always 125. Then test the device's actual ceiling, because it is usually lower than the spec's.
  5. Separate the four data blocks even when the numbers look adjacent. In Modicon 5-digit notation 0xxxx is coils, 1xxxx discrete inputs, 3xxxx input registers and 4xxxx holding registers — so 40001 is a holding register and coil 1 is 00001. Holding register 40001 and input register 30001 are both offset 0 on the wire, in different address spaces, reached by different function codes. No driver can merge across them.

Where the 125-register ceiling comes from

The protocol maximum for a register read is 125, and the number is arithmetic rather than arbitrary. MODBUS Application Protocol V1.1b3 §4.1 caps the PDU at 253 bytes. An FC 03 response spends 1 byte on the function code and 1 on the byte count, leaving 251 for data; 251 / 2 = 125 registers, with a byte left over. §6.3 writes that ceiling into the request as a quantity range of 0x0001 to 0x007D.

The same arithmetic gives the other limits, and they are not all 125:

FCOperationSpec maximumClause
01Read Coils2000 (0x07D0)§6.1
02Read Discrete Inputs2000 (0x07D0)§6.2
03Read Holding Registers125 (0x007D)§6.3
04Read Input Registers125 (0x007D)§6.4
15Write Multiple Coils1968 (0x07B0)§6.11
16Write Multiple Registers123 (0x007B)§6.12

FC 16 is 123, not 125. A write request carries the start address, the quantity and a byte count itself, so fewer of its 253 bytes are left for data than in a read response. A driver configured to write 125 registers in one FC 16 is over the limit and will be refused — usually with exception 03, ILLEGAL DATA VALUE (§7), which reads like a scaling problem and is not one.

On Modbus TCP the 253-byte PDU sits behind the 7-byte MBAP header, giving a 260-byte ADU ceiling (MODBUS Messaging on TCP/IP Implementation Guide V1.0b §4.1). The register counts themselves do not change.

The device's limit, not the spec's

That spec number is often wrong for real equipment. Serial gateways, protocol converters, and older controllers frequently cap responses at 32, 50, or 64 registers, or limit the number of concurrent requests. If the driver is configured for 125-register blocks and the gateway silently truncates or rejects at 50, you get intermittent bad quality that looks like a timeout but is actually an oversized request.

Behind a serial gateway, read the exception code rather than the symptom. 0x0A, GATEWAY PATH UNAVAILABLE, and 0x0B, GATEWAY TARGET DEVICE FAILED TO RESPOND (§7), both come from the gateway and not from the slave. 0x0B specifically means the gateway forwarded your request and the serial device never answered — a wiring, address or baud problem downstream of the gateway, not a block-size problem in your driver. Tuning block size against an 0x0B is wasted time.

When commissioning an unfamiliar device, start with a conservative block size, confirm clean reads, then increase it while watching for exceptions or truncated responses. Record the working maximum in the project notes so the next engineer does not rediscover it during an outage.

Mixed data types inside a block

A 32-bit float, a 32-bit integer, and a 16-bit status word can sit next to each other in the register map. The driver reads them as raw 16-bit registers in one block, then each tag applies its own decoding (word order, byte order, scaling) on top. Block optimization does not change decoding.

Two things to watch:

  • A 32-bit value spans two registers. Do not let a block boundary split it, or one half is read in a different request and the value can tear during transient reads.
  • Word-swap and byte-swap settings are per tag, not per block. Grouping registers together does not force them to share an endian convention.

Reading the results

After changing block settings, do not trust the theory. Measure.

  • Watch the driver diagnostics for request count per scan and average response time. Fewer, larger requests with stable response time is the goal.
  • Check for a rise in exception code 02 after widening gap tolerance. That means a block is now reaching into unmapped registers — and remember that a device returning zeros instead of 02 will show you no rise at all.
  • Confirm the slow tags did not get pulled into the fast scan group, inflating fast-scan load.
  • On serial links, compare total scan time before and after. The expected saving is 11.46 ms per request eliminated at 19200, minus 1.146 ms for every unused register you bridged. If the measured saving is far off that, something other than framing dominates — usually slave turnaround.

If request count dropped but bad quality appeared, the optimization went too far. Pull gap tolerance or block size back until reads are clean, then stop.

Commissioning checklist

  1. Export the register map and confirm frequently read tags are contiguous.
  2. Group tags by required poll rate before touching block size.
  3. Measure the slave's turnaround delay, then compute the gap break-even: 10 registers at 19200 with no turnaround, ~19 registers if it answers in 10 ms.
  4. Set a conservative maximum block size for unknown devices and verify clean reads.
  5. Increase block size until you find the device's real limit, then back off one step. Check FC 16 separately against 123, not 125.
  6. Read one register you know is unmapped and record whether the device returns exception 02 or zeros. That answer decides how much gap tolerance you can risk.
  7. Verify no 32-bit value is split across a block boundary.
  8. Record request count per scan, average response time, and the working block size in the project notes.

Read tags together when they live together and share a poll rate; split them when the bridged span exceeds the break-even, when a gap reaches unmapped registers, or when a value would tear across a boundary. The fewest requests that return clean, whole values wins — not the largest block the protocol will technically allow.