Hello , recently found a bug about register offset and modbus error codes.
Register Offset(u8regsize) is a uint8_t variable, you cannot exceed address range 255.
When ever you try to read a address(uint16_t) out of the this range , address is down casted to uint8_t and compared to table size in order to decide whether read address is exceeded this range.
Example case:
Register Table size 250.
Intended register read adress is 2000.
In that case we expect an EXC_ADDR_RANGE error code but we got successfull reading.
Hello , recently found a bug about register offset and modbus error codes. Register Offset(u8regsize) is a uint8_t variable, you cannot exceed address range 255.
When ever you try to read a address(uint16_t) out of the this range , address is down casted to uint8_t and compared to table size in order to decide whether read address is exceeded this range.
Example case:
Register Table size 250. Intended register read adress is 2000. In that case we expect an EXC_ADDR_RANGE error code but we got successfull reading.
Modbus Frames decomposition
But if we want to read register at offset 509.
Modbus Frames decomposition