read SINT8 and UINT8 using client.convert_from_registers(...) ? #2520
-
How to read an SIN8 correctly using convert_from_registers since BinaryPayloadDecoder is deprecated? I cannot find any examples... How to do that? BR, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
What is SINT8 ? The modbus protocol do not support less than 16bit (if you read e.g. 8 coils==bit the response is padded to 16bit bit. So an INT8 cannot be read, it will be padded as an INT16. If you have (a really unique and weird) modbus device that implements int8 then you have to see with debug how it's actually transmitted because it's surely not modbus standard. If you device packs 2 int8 in one register (again something very unusual), then you run a to_bytes on the register returned. to/from is there to help with the standard cases, more advanced usage (as documented) is left to the app. |
Beta Was this translation helpful? Give feedback.
What is SINT8 ?
The modbus protocol do not support less than 16bit (if you read e.g. 8 coils==bit the response is padded to 16bit bit.
So an INT8 cannot be read, it will be padded as an INT16.
If you have (a really unique and weird) modbus device that implements int8 then you have to see with debug how it's actually transmitted because it's surely not modbus standard.
If you device packs 2 int8 in one register (again something very unusual), then you run a to_bytes on the register returned.
to/from is there to help with the standard cases, more advanced usage (as documented) is left to the app.