Ask a question

3005 questions

3421 answers

2592 comments

12004 members

Ask a question
0 votes
38 views
in Vehicle tracking by


Documentation states (image above), that Engine Coolant Temperature is sent in 1 byte, unsigned, value from -40 to 210.
One byte integer value is from 0 to 255 unsigned or from -127 to 128 signed. How to parse the value? Should we first assume that value is unsigned and then subtract 40? Because if we parse this as a simple signed 1 byte integer it can go out of bounds of a valid value.

1 Answer

0 votes
by

Hello.

As I can see on attached screen it is signed value.

For example if you receive D8 Hex value as AVL 127, it would be -40 (Decimal from signed 2's complement)

You could use rapid tables for convering hex to dec from signed 2's complement:

https://www.rapidtables.com/convert/number/hex-to-decimal.html

Regards