DS18B20 on Picaxe20M2

rq3

Senior Member
Do I need to add the temperature conversion delay as a pause,

Code:
Readtemp B.1, b0
pause 1000
or is it "automatically included" in the readtemp command? I ask because the displayed temperature seems to "stall" at a reasonable but fixed value for long periods of time.

Thanks,
Rip
 

PhilHornby

Senior Member
The delay is effectively built-in ... from what I recall, it's not a fixed delay, Readtemp loops and watches the one-wire bus for the response.
 

westaust55

Moderator
To Quote Technical from Rev Ed:
M2 and X2 parts do READTEMP conversions quicker than the M parts, as they continuously poll the device to 'ask it' when it has finished the conversion. The M parts simply wait 750ms regardless.
 

Jeremy Harris

Senior Member
That's correct.

When I changed to using a 20M2 in my house data logger, from the previous version that used a 14M, the DS18B20 "readtemp10"s all speeded up, by so much that I had to change the display subroutine to get the display update back to the original fixed rate. This was complicated by the fact that DS18B20 conversions seem to vary in the time they take, so when reading a handful of sensors the display update rate was changing a lot. I ended up triggering a display update from the RTC, just to get a fixed time interval, whereas before I'd just padded the 14M code with a pause to do the same thing.

From what I can tell, the 750ms in the data sheet for the DS18B20 is a worst case, and a lot of the time it does the conversion a fair bit faster.
 

Puuhaaja

Senior Member
Few years ago I tested that how long it takes to read temperature Let's say... about 1000 times with lcd. If I remember right..it took about 5ms to read temperature using 18m2 chip.
 

westaust55

Moderator
Few years ago I tested that how long it takes to read temperature Let's say... about 1000 times with lcd. If I remember right..it took about 5ms to read temperature using 18m2 chip.
I would be surprised if it was quite that fast.
The data sheet:
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Indicates a max of 93 ms for 9 bit resolution
Increasing to a max of 750 ms for 12 bit resolution

These are max times so yes somewhat less would be typical.
 

Puuhaaja

Senior Member
Regarding the datasheet I remembered wrong. Maybe it was 50ms. In datasheet there is no minimum time so that 50ms time can be possible. I Also made same test using readtemp12 command and it really took much more time.
 
Top