I have a question about conversion. In a document about DS18B20 temperature sensor i need to convert 18.25C to binary. Can someone explain how to do it.
I tried looking for answers on the internet but i can't find anything similar.
It looks like the binary value is the decimal temperature in increments of 0.0635 degrees (0.5 = 0.0625*8 = 0008h
, 10.125 = 0.0625*162 = 00A2h
)
so the conversion for 18.25
would be
18.25/0.0625 = 292 = 0124h = 0000 0001 0010 0010
Or, since 1/0.0625 = 16
, you could convert it by multiplying by 16:
18.25 * 16 = 292 = 0124h = 0000 0001 0010 0010