PDA

View Full Version : Onewire.pbp sample program -- high readings



Michael
- 5th July 2017, 22:29
This program --

http://melabs.com/samples/PBP-mixed/onewire.htm

works fine but at room temperature I'm getting --
178 C
350 F

I am using a probe with a DS18B20 sensor, perhaps that's it but I can't imagine why, the temperature storage is word and I read where the DS18 B 20 has higher resolution?

Anyway, can anyone see why I'm getting these high readings?

I simply did a copy and paste with the code -- didn't change a thing. -- Thanks.

richard
- 5th July 2017, 23:56
a ds18b20 is not a ds18s20 , the code you linked is for a ds18s20. check the data sheets

a ds18b20 does not have or use count_remain, count_per_c at all. there are plenty of examples for either device in the forum but
some do not explicitly state which device they match. caveat emptor


check these scratch pad definitions

Scampy
- 6th July 2017, 10:36
This works for me using DS18B20




DQ VAR PORTA.5 'One-wire data pin for Ds18B20
GIE VAR INTCON.7
temperature VAR WORD ' Temperature storage

'************************************************* ******************************
'Get and display the temperature
GIE = 0
owin DQ, 1, [],NoDevice ' pole 1 wire bus - if no responce then device not pressent
OWOUT DQ, 1, [$CC, $44] ' Start temperature conversion
OWOUT DQ, 1, [$CC, $BE] ' Read the temperature
OWIN DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE]
GIE = 1 ' turn interupts back on
temperature = temperature */ 1600
lcdout $FE,$D4+0,"TEMP ",dec(temperature / 100),$DF,"C"


NoDevice:
lcdout $FE,$D4+0,"TEMP N/C "
GIE = 1
goto main

Michael
- 6th July 2017, 16:04
Ok thanks much -- didn't notice the "S".



I looked at this --

https://www.maximintegrated.com/jp/app-notes/index.mvp/id/4377

and I see the difference in the memory map, but can the example --

http://melabs.com/samples/PBP-mixed/onewire.htm

be easily adapted to work with the 18B20 maybe? Just want to get this going.

I just did a search for DS18S20 probe and it also shows it as DS18B20. And yet, you're saying they are not the same animal. ? These listings seem to think they're the same. (!) wrong ?

https://www.ebay.com/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313.TR0.TRC0.H0.Xds18s20+p robe.TRS1&_nkw=ds18s20+probe&_sacat=0


I'll try your code Scampy -- thanks. Would like to be able to modify the melab sample though as I have it inside some other code and a complex breadboard already setup.

Michael
- 6th July 2017, 16:07
Well Hell, just found this --

http://melabs.com/samples/LABX1-16F877A/temp_DS1822.htm