Closed egoltzman closed 3 years ago
You are right, this is part of the original Arduino library and its limitations. I will update the library soon.
Hi @egoltzman I double checked Modbus documentation and the maximum size of a MODBUS RTU frame is 256 bytes. Therefore, to fulfill your requirement you can issue many Modbus queries to cover the range of registers that you need, or change the library by yourself. However, this last option will be out of specification, therefore I will keep the library in this repository as is.
Hello @alejoseb, thank you for getting back to me on this. I don't think the problem I'm pointing refer to the frame size. I refer to the register address that is built out off two bytes, the ADD_HI and ADD_LO and in word() you build a 16bit address value out of those two bytes, but the result is stored in u8StartAdd and thus the address value is truncated to 8bit and the lib does not let the user access registers above 256. No?
@egoltzman You are right, I will check what are the implications of using the right casting in the library, since the frame size must be keep regardless of the addressing scheme.
Hi @egoltzman I updated the library, now it is possible to read/write registers using a 16-bit address. Besides, I added the validation to maintain the 256-byte frame limit regardless of the register's address. You can close the issue after you validate it, or I will close it by the following week.
Hi, I have 2600 registers (40000-42600) I fail to read above 4256 I see that in the code you put the 16bit address into an 8bit variable, is this OK?