pyhys / minimalmodbus

Easy-to-use Modbus RTU and Modbus ASCII implementation for Python.
Apache License 2.0
309 stars 145 forks source link

Possible bug in ._num_to_two_bytes function #124

Closed cornebester closed 1 year ago

cornebester commented 1 year ago

Hi team

Somewhat dumbfounded by the results for 5897 and 5898. UINT16s

5897 should be 0x1709 and 5898 0x170A?

Version: 2.1.1

>>> minimalmodbus._num_to_two_bytes(5896)
b'\x17\x08'
>>> minimalmodbus._num_to_two_bytes(5897)
b'\x17\t'
>>> minimalmodbus._num_to_two_bytes(5898)
b'\x17\n'
>>> minimalmodbus._num_to_two_bytes(5899)
b'\x17\x0b'
>>> 
cornebester commented 1 year ago

Not bug. My bad. Python returns asci for 09 and 10.