Using DS18S20 vs DS1820 with 4x7 LED Displays


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    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

  2. #2
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    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.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    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

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Give this a try...
    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
    <br>
    DT

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    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

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You're Hoşgeldiniz
    <br>
    DT

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 07:14
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 05:59
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 21:19
  4. DS18S20 displays wrong temperatures
    By Shozo Kanamori in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th August 2007, 04:18
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts