Modbus - Reading dozens of non-contiguous addresses

I will need to read dozens of non-contiguous modbus addresses and making dozens of different modbus read nodes does not make sense. Is there a better way to do this?

Depending on how far apart the dozens of addresses are, sometimes it is more efficient to make one large request. Use the values in the specific registers you are interested in and ignore the rest. On several old control systems I used to work with, that had time/update rate concerns, it was better to make 1 request for 100 contiguous registers than to make 10 requests for 1 register each that were scattered throughout that address space.

2 Likes

Thanks Glenn. I will experiment with requesting one large chunk.

Be advised that some devices will send you an exception back if you try to read a block with unused registers in between. And then others will not be able to send you100 registers in one poll. It depends on how much memory a device has and if the developer could create a big enough message buffer. But otherwise, yes it is always better to read a whole block of as many registers as possible and discard what you don’t need if there is a reasonable ratio between used and discarded.

2 Likes