Modbus Serial Master v1.0 8-14-2006 Reading Holding Register Limit

I am using the Modbus Serial Master v1.0 8-14-2006 sample code provided by Opto 22 to interface with a Siemens GC. I can successfully read 125 consecutive holding registers but when I try to increase the number above 125 I get errors and no data is received. Any ideas?

125 is the max for function 3 & 4 according to MODBUS Application Protocol Specification V1.1b

Thank you.

What would you do if you needed more than 125 registers?

Also, do the registers have to be consecutive? If not, how would you code to get the non-contiguous registers?


As you have probably found, you frequently need to read registers at non-consecutive addresses. You just need to make multiple requests with a different start register and then copy the results out of your Modbus holding registers into a new variable/table each time. The same goes for reads with more than 125 registers.

See the attached image for the pattern I typically use when reading from non-contiguous addresses.

I understand.

Thanks Phillip