PDA

View Full Version : Using DS18S20 vs DS1820 with 4x7 LED Displays



sayzer
- 11th October 2006, 08:54
Hi there,

Since DS1820 temp chips are replaced by DS18S20, we get a slower convertion time.
500ms vs. 750ms.

When using 18S20 (or 18B20), I get a blank on LED display while the convertion is in progress while I get no blank display using 1820.

Any idea how to overcome this issue?

Darrel Taylor
- 11th October 2006, 10:21
Been awhile, but if I remember correctly, you can send a "Start Conversion", then just check the busy flag on each loop. When it's done, goto a subroutine to get the result.

Most examples that I've seen just sit in a WHILE/WEND or similar loop waiting for the busy flag without doing anything else. 3/4 of a second is a long time.
<br>

DynamoBen
- 11th October 2006, 18:28
Been awhile, but if I remember correctly, you can send a "Start Conversion", then just check the busy flag on each loop. When it's done, goto a subroutine to get the result.

Most examples that I've seen just sit in a WHILE/WEND or similar loop waiting for the busy flag without doing anything else. 3/4 of a second is a long time.
<br>

I use a timer to send the start conversion every second. Then I check the flag via a loop, based on the flags status I either retrieve the info and update my display or continue on with other things. While/Wend wastes too much time for me.

sayzer
- 12th October 2006, 10:07
Thanks for the info DT.

Let me work on that bit.

Darrel Taylor
- 13th October 2006, 03:58
sayzer,

Are you using Bruce's code with the SLED4C, or independant 4 digit seven segment displays.

I was just thinking that if it's the SLED4C, it might be a different problem. Don't know what, but it wouldn't blank no matter how long it took for the conversion.

Just curious.
<br>

sayzer
- 13th October 2006, 07:55
...Are you using Bruce's code with the SLED4C, or independant 4 digit seven segment displays...



Thanks DT.

I am using Bruce's code with independent 4-digit Seven segment displays (two displays; 8 digit).

sayzer
- 15th October 2006, 12:59
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/showthread.php?t=3680&highlight=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



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.

DynamoBen
- 15th October 2006, 16:12
Darrel made an include that does temp conversion, and it goes into negative temperatures.

http://www.pbpgroup.com/modules/wfsection/article.php?articleid=18

Give this a try.

Darrel Taylor
- 15th October 2006, 18:36
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

:confused: :confused:
<br>

sayzer
- 15th October 2006, 18:52
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.

Darrel Taylor
- 15th October 2006, 19:22
Give this a try...
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
<br>

sayzer
- 15th October 2006, 23:07
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.

Darrel Taylor
- 15th October 2006, 23:27
You're Hoşgeldiniz :)
<br>

sayzer
- 16th October 2006, 04:12
Very nice of you "trying" to say that Darrel.

I see what you wanted to say, thank you.
But the meaning is a typical "lost in translation".
"Don't mention it" in Turkish = "You are welcome" in English
"You are welcome" in English = "Well Arrived" or "Welcome to a 'place'..."


Here are some funny ones:
Italian:
"Ladies, leave your clothes here and spend the afternoon having a good time."

Japanese:
"Special cocktails for the ladies with nuts"

Swedish:
"Fur coats made for ladies from their own skin"
"Our wines leave you nothing to hope for"

French:
Colgate introduced a toothpaste in France called Cue, the name of a notorious porno mag.

French:
"Please avoid coca watering, cream cleaning, wet towels wrapping, and ironing drying."


And a funny one in German:
"It is strictly forbidden on our black forest camping site that people of different sex, for instance, men and women, live together in one tent unless they are married with each other for that purpose."


Have more here:
http://www.ojohaven.com/fun/translation.funnies.html


---------------------------------

Darrel Taylor
- 16th October 2006, 04:36
Ha Ha,

Well, at least I didn't end up calling you a bad name or something.

Darn those on-line translators.

The thoughts still there though...

You're welcome. :)

P.S. Funny Link.