Originally Posted by Darrel Taylor
Thanks DT.
I am using Bruce's code with independent 4-digit Seven segment displays (two displays; 8 digit).
Originally Posted by Darrel Taylor
Thanks DT.
I am using Bruce's code with independent 4-digit Seven segment displays (two displays; 8 digit).
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
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.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Darrel made an include that does temp conversion, and it goes into negative temperatures.
http://www.pbpgroup.com/modules/wfse...p?articleid=18
Give this a try.
Sayzer,
>> For DS18B20, negative temp value is no problem with Bruce's code.
I'm confused. Does that mean Bruce's code fixed your problem? Or, do you still need help?
And, you're asking about the DS18B20, but the table is for a DS1820
![]()
<br>
DT
Sorry for confusion.
I have already fixed my problem with DS18B20. I have no problem. I get nice negative value reading, too. Everything is perfect.
But,
For DS1820, how do we read negative values? When the temp gets below zero, how do we read it? I could not find a PBP sample code for negative part. I have about 50pcs DS1820 left in hand and have a chance of getting rid of them if I can read negative values.
The table is for DS1820.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Give this a try...<br>Code:Sign VAR BIT TempC VAR WORD ; read DS1820 here Sign = TempC.15 TempC = ABS(TempC) TempC =(TempC>>1)*10 + (TempC.0 * 5) IF Sign then LCDOUT "-" LCDOUT dec (TempC/10),".",dec TempC//10
DT
It is finally working now for the negative values.
I did not have this TempC = ABS(TempC) before TempC =(TempC>>1)*10 + (TempC.0 * 5)
But, now I get correct values.
Thanks a lot Darrel.
Regards.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks