Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadHoldingRegistersResponseBody.fromRequest shouldn't multiply requestBody.start by 2 #336

Closed
ameyat2812 opened this issue Jan 9, 2024 · 2 comments

Comments

@ameyat2812
Copy link

In the spec, for the Read Holding registers request that comes from the Modbus client, byte 3+4 combined forms the 2-byte starting address of the register to start reading from. Please refer to https://www.simplymodbus.ca/FC03.htm

In the ReadHoldingRegistersResponseBody.fromRequest function, requestBody.start is multiplied by 2 to arrive at startByte that I think is not needed, requestBody.start should be treated as starting address in the holding register buffer

@ameyat2812
Copy link
Author

@stefanpoeter Any thoughts

@stefanpoeter
Copy link
Member

Hey @ameyat2812
the Modbus Specs define the holding register to be of 2-byte sized absolutes. So a address in modbus for, example 4, is located in a 1-byte based buffer at offset 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants