The registers length and address values are not properly checked for restrictions. For example, it is possible to specify an address of 65,535 and a length of 100, which is an impossible combination. There is an incorrect limit of 200 on the number of registers. After all, the Modbus address space can accommodate 65,536 registers.
💡 It is suggested that when increasing the address, the length should be reduced to 65536 - address, and when increasing the length, the address should be reduced to 65536 - length.
P.S. Could you please explain why a "5-digit" address (0-9999) was implemented when it does not comply with the Modbus specification?