Closed brainelectronics closed 1 year ago
Found during #33, see https://github.com/brainelectronics/micropython-modbus/pull/33#issuecomment-1336274272 at section "Problem 3" and "Problem 5"
Defining a register on the MicroPython Modbus client device as e.g. (valid for HREGS, COILS, ISTS, IREGS)
{ "HREGS": { "HREG_NAME": { "register": 93, "len": 3, "val": [29, 38, 0] } } }
does not allow to read ONLY register 94 which would hold 38.
94
38
Reason/Root cause: Registers are defined as specified by the register element, see https://github.com/brainelectronics/micropython-modbus/blob/c45d6cc334b4adf0e0ffd9152c8f08724e1902d9/umodbus/modbus.py#L53-L55 for a coil. The provided value is added as value to the dictionary at the key register, here 93. Thereby no element/key 94 exists in the Modbus _register_dict
register
value
93
_register_dict
Found during #33, see https://github.com/brainelectronics/micropython-modbus/pull/33#issuecomment-1336274272 at section "Problem 3" and "Problem 5"
Defining a register on the MicroPython Modbus client device as e.g. (valid for HREGS, COILS, ISTS, IREGS)
does not allow to read ONLY register
94
which would hold38
.Reason/Root cause: Registers are defined as specified by the
register
element, see https://github.com/brainelectronics/micropython-modbus/blob/c45d6cc334b4adf0e0ffd9152c8f08724e1902d9/umodbus/modbus.py#L53-L55 for a coil. The providedvalue
is added as value to the dictionary at the keyregister
, here93
. Thereby no element/key94
exists in the Modbus_register_dict