simonvetter / modbus

Go modbus stack (client and server)
MIT License
280 stars 89 forks source link

Should be able to read 125 holding registers #44

Closed jonathangjertsen closed 3 weeks ago

jonathangjertsen commented 4 months ago

The maximum number of registers that fits in a read is 125 while the maximum number of registers that fit in a write is 123. This package currently generates an error if you try to read 124 or 125 registers, because it uses 123 in readRegisters.

https://github.com/simonvetter/modbus/blob/ff51403728b4e53e6fa7982f25bbf88a53854af4/client.go#L1042

pstlabdev commented 1 month ago

I ran into this as well, however the transport of 125 was good. I updated the 123 to 125 to eliminate the error.

simonvetter commented 3 weeks ago

Fixed in v1.6.3, feel free to reopen if you think otherwise.

Thanks for the report!

pstlabdev commented 1 week ago

Thanks for the update. For specifics from the spec on holding registers is: 123 write & 125 read. https://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf