Ok. I got it working with no delay (for DS18B20).
Thanks for the info DT.
Meanwhile, I encountered something insteresting.
None of the DS1820 codes on this forum, and on other sites, has a routine for negative temps.
Isn't it interesting? All of the codes read the bit that indicates "negative" but that is it. With these codes, when the temp is negative the actual temp value becomes incorrect.
DT, you have a post here : http://www.picbasic.co.uk/forum/show...ghlight=DS1820
But it did not work for me. I did not understand how a negative result of an equation would work => TempC = 0 - TempC
Also, here is the table from DataSheet.
--------------
<img src="http://img10.picsplace.to/18/ds1820.GIF" alt="Image Hosting by PicsPlace.to" >
------------------
Here is the most popular code for DS1820
Code:
owout DQ, 1,[$CC, $44]
owin DQ, 4,[var1]
if var1 = 0 then 'Being busy issue.
owout DQ, 1,[$cc, $BE]
owin DQ, 0,[tempc.lowbyte, tempc.highbyte, skip 4, var1,var2]
endif
negsign=tempc.15
TempC = (TempC>>1)*10 + (TempC.0 * 5)
-------------------------------
For DS18B20, negative temp value is no problem with Bruce's code.
Bookmarks