PDA

View Full Version : Bug in temperature request DS1820



lerameur
- 25th February 2011, 16:55
Hello, I am using the one wire temperature probe sensor.
It does work , I do get the right temperature, but only for the first output on the lcd it is showing 85.00 for both celcius and farenheit. It does show the right temperatures in the second loop and on. But why does ti show this information on the first loop. Eventually this will not be good as I will be taking the first value to proceed.


GetTemperature_Inside:

owout DQ2,1,[$cc] : owout DQ2,0,[$44] : Pause 500 : owout DQ2,1,[$cc] : owout DQ2,0,[$be]
owin DQ2, 0, [temperature2.LOwBYTE, temperature2.Highbyte, Skip 4, count_remain2, count_per_c2]


temperature = ((( temperature2 >> 1) *100)- 25) + (((count_per_c2 - count_remain2) * 100) / count_per_c2)
tempF = (((temperature /5) *9 ) +3200)

lcdout $FE,1, "TempC: ", "+", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
lcdout $FE,$C0, "TempF: ", "+", dec2 (tempF / 100) , ".", dec2 (tempF // 100)," ",$DF,"F"
pause 100


return

Darrel Taylor
- 25th February 2011, 17:23
85 is the default power-up temperature value.

A conversion takes 750ms but you are only waiting 500, so each time you read it, it's getting the result from the previous conversion, not the current one.

lerameur
- 25th February 2011, 17:27
Thanks
thats what I thought at first, i had a Pause 300, I guess I will put a longer on.
oufff, I was hoping it would something easy. thanks again

K

Charlie
- 26th February 2011, 12:30
There is also a known bug in the DS1820, in that the power up reset does not work properly and it will report 85C on the first reading after power up. To work around the issue, reset the device by software command before taking the first reading.

Acetronics2
- 26th February 2011, 17:13
Hi,

a bigger bug of the DS1820 ( not 18 B or S 20 ) is the error on temp that can reach +/- 3° C ...

the sample I run on my EasyPic 5 shows a ... + 2.50 °C error ... ;)

But never observed any initialization real error ... measurements always start @ the good value ... if program respects the conversion delay, of course.

Alain

MOUNTAIN747
- 26th February 2011, 18:29
I’ve had good results with the DS1820 using a lookup table for C to F conversion. Checking results with a Thermo King dry well calibrator the DS1820 was on the on the money to the nearest full deg fahrenhite from 7*F to about 60*F, it was 1 deg high from about 60*F to about 80*F and on the money from about 80*F to 127*F. I checked two DS1820’s and both fail to function properly below 6*F. The lookup table was from 0*F to 127*F. If bit7 (.5C) is a one it forces a roundup to your higher Fahrenheit temp in your table read if you have two Fahrenheit degrees represented by the same Centigrade temperature. Both DS1820’s gave almost identical performance.