Temperature Conversion

iian_stew

New Member
Hello everyone,

I am having a little problem with the DS18B20. I have been using the readtemp command so far and the temperature return has been working fine.

I now want to start using the readtemp12 command for increased resoution.

I would like to know how the conversion works. I would like to be able to do the folowing. I am putting together a school experiment and want to do the following.

I want the students to tabulate the values of temperature in degrees and also to tabulate the 12bit value. So I think I will need to use the readtemp and the readtemp12 value.

I hope this makes sense!

Also, does anyone know what the conversion is?


Thanks so much
 

MORA99

Senior Member
There is alot of threads on the same subject, try search for DS18B20.

The value from readtemp12 is temperature*16, the first 3 bits are signbits that shows if the temperature is below 0.
The readout is not twos complement, but just regular binary, and if a signbit is set, its below 0.

But theres a lot of code on the forum already, so you dont have to write it yourself.
 
Top