pyhys / minimalmodbus

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

Possible bug in ._num_to_two_bytes function #124

Closed cornebester closed 11 months ago

cornebester commented 11 months 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 11 months ago

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