Thread hex to decimal conversion (12 answers)
Opened by thegreatonech at 2010-06-10 15:05

Gast thegreatonech
 2010-06-10 15:05
#138177 #138177
Hallo,

I've got a hash. every key has a hexadecimal value with two signs like "fe" or "05" or "f4".
I have to put two of this hexs together to a hex with four signs like "fe05". (The first with the second, the third with the forth...)
coverted in decimal and multiplied with 10 i should get some temperatures.

my problem is: i can put the hexs together with "." and convert to decimal with "hex($hexvalue)". but they are not alway right! sometimes i've to put the lower value first ("feff") and sometimes i've to put the higher value first ("fffe") to get a logic result.

the hexs are out of a file. the description of the file means following:

The temperature value is a signed integer (two's complement, low - high representation) containing the temperature multiplied by decimal 10).

when I always take the lower value first I get some logic and some not logic temperatures. I guess I don't understand the "low - high representation" in the description.

i hope that someone can help me!

thank you[/code]
Last edited: 2010-06-10 15:07:15 +0200 (CEST)

View full thread hex to decimal conversion