Skip to content

Consecutive and multiple blocks ​

Need: the device has a whole block of parameters, or parameters spread over several blocks, to check in one go. Matches the library's A consecutive.json and A multi-segment.json.

CaseWhat it does
A consecutiveFC16 writes 0x00AA to all of 0x0000..0x000A (11 registers), then reads all 11 back at once and compares
A multi-segmentThree blocks: 0x0000..0x0002 gets 0x00AA, 0x0010..0x0012 gets 0x00BB, 0x0020 gets 0x00CC, each read back

Multiple blocks result

How it is written

  • When a Write gives a single value for a range of several registers, every position gets that value. To write different values, use a values list.
  • When a Read gives a single expected, every value in the range must equal it; with a list, values are compared one by one.
  • Per the Modbus specification, one FC03 reads at most 125 registers and one FC16 writes at most 123. Split larger ranges into several steps.

Download the sample script ​

Sample script

Before running it, start a Slave window on 127.0.0.1:502 and click Listen, then open the script with Open JSON in Script mode and click Run. See How to use the examples.

Roach Modbus Tool by Mr.Roach