Hmm, that is an interesting observation Daniel.
However, it does not quite follow my own.
Here is what I do to follow the specification of the DS18B20 and to verify the results:
Code: Select all
pi@TestRig ~ $ cat /sys/bus/w1/devices/28-000004da2313/w1_slave
3f 00 4b 46 7f ff 01 10 47 : crc=47 YES
3f 00 4b 46 7f ff 01 10 47 t=3937
I can't get a below zero degrees C at the moment, it's too warm here, and I can't put my rig into the freezer at the moment, this is as low as I could get it. Not that it matters much though.
So, the t=3937 or 3.937 degrees Celcius.
We need to verify that result against the Hex output of 0x3F00.
BTW, my Alarm Bytes (TH and TL) are always 0x4B 46 while your's are 0xFF FF. I can't explain that at the moment.
In any case the two byte value of 0x3F 00 are made up as follows (following the specification)
Code: Select all
Byte2 Byte1
Nibble1 Nibble2 Nibble3 Nibble4
S S S S S b6 b5 b4 b3 b2 b1 b0 b-1 b-2 b-3 b-4
Byte1 and Byte2 need to be reversed, so 0x3F 00 must be read as 0x00 3F
S are the sign bits, either 0 for positive or 1 for negative results
b6 through b0 are the positive portion of the temperature. b6 means 2^6
b-1 through b-4 are the negative portion. b-1 means 2^-1
Following this, the sign bits are SSSS S = 0000 0, which means we have a temperature above 0 degrees Celcius.
The positive portion of the temperature is in bits 000 0011, which is 3d.
The negative portion is 1111 or 1*2^-1 + 1*2^-2 + 1*2^-3 and 1*2^-4 = 0.9375
so the temperature derived from the Hex bytes is 3.9375 and the same as the t=3.937.
I would really like to see an example where the Hex data coming from the DS device through the W1 drivers is different from the t= value.
I hope this helps,
Paul