Reading a DS18B20 temp sensor without using "readtemp"

JanJor

Member
Dear Forum, I was curious to find out how to read the DS18B20 temperature sensor without using the wellknown and easy-to-use READTEMP command. So I took the data sheet and started reading. However, I gave up because I did not understand most of it (I did understand the data sheet for the ADS1115 and MPU6050 after reading them three times, but the DS18B20 clearly is beyond my level of understanding.
And searching the Forum did not help, everyone working with the sensor simply uses "readtemp".

Please note: this is NOT a request to the forum to start working to solve this question (Although the Forum is always very helpfull!).

It is merely a request to those people (if existing) who, also out of curiosity, tried to unravel this problem and succeeded where I failed: if you managed to write a Picaxe program to read the DS18B20, without using "readtemp", would you be so kind to share it with me, or at least "lift a tip of the curtain"as we say in the Netherlands?
Thank you very much in advance,
Janjor.
 

Buzby

Senior Member
I've not got into reading temperatures or any other 1-wire stuff by using the OWIN and OWOUT, but if I wanted to I'd start here ...

Cheers,

Buzby
 

AllyCat

Senior Member
Hi,

I've looked at the timing of the "One Wire" bus (which the DS18B20 uses) and it's not possible to "bit bang" the data (too fast). So you would need to use the One Wire instructions (OWIN/OUT) which are available only with the X2 PICaxes.

But I'm not sure what would be the advantage of doing that; I believe that the READTEMP{12} command used to "block" the PICaxe for about 750 millisconds, but that has now been "fixed" with the M2 and X2 chips. However, the One-Wire commands can be used to read multiple 18B20s more quickly if required.

Cheers, Alan.
 

westaust55

Moderator
Back in 2010 I did quite a bit of work with 1-wire devices.
Much off that is documented in this thread.
 

JanJor

Member
Dear Buzby, AllyCat, IWP and Westaust55, thank you vry much for your input.
I apparently missed Westaust55's thread while searching the forum last week.
Thanks Westaust55, this is very suitable info indeed, and it will keep me busy for a while.
Best regards,
Janjor.
 
Top