Ds18b20


Closed Thread
Results 1 to 25 of 25

Thread: Ds18b20

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    31

    Default Ds18b20

    i have a problem i made temp sensore project based on ds1820 but i want to replace it with ds18B20 for high resolution but when i change it i got strange readings , i think that i have to change something in code can some one help me do that attached is code
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    OWOut DQ, 1, [$CC, $4E, 0, 0, DS18B20_12bit] '


    OWOut DQ, 1, [$CC, $44] ' Start conversion
    WaitLoop:
    While not DQ
    Wend

    OWOut DQ, 1, [$CC, $BE]
    OWIn DQ, 2, [Temperature.Lowbyte, Temperature.Highbyte]

    Convert_Temp:

    If Temperature.15 then
    Temperature= ~Temperature +1
    Twist = 1
    Endif

    TempC = (Temperature & $7FF) >> 4
    Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
    Temperature = TempC*100 + Float

    If Twist then
    V= 10000 - Temperature ' 25 C=12500 0 C=10000 -10 C=9000
    Twist = 0
    else
    V= 10000 + Temperature
    EndIf



    ' SUBROUTINES:
    '----------------------------------------
    SelectSign:
    If v = 10000 then ' Temperature = 0 C.
    Sign=" " ' No sign
    Else
    If v < 10000 then ' <> 0
    Sign="-" ' Temperature below 0 C.
    Else
    Sign="+" ' Temperature above 0 C.
    EndIf
    EndIf
    Return

    '----------------------------------------
    DisplayTemp:
    If V >= 10000 then ' Above 0 C.
    Temperature=V-10000
    Else
    Temperature=10000-V ' Below 0 C.
    EndIf
    LcdOut $FE, $C0, Sign, DEC (Temperature / 100), ".", DEC2 Temperature, " ",223,"C "
    Return

  3. #3
    Join Date
    Aug 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    hi,
    thanks for replay but i am beginner in pbp so can u guide me where is the part i have to replace in my old code

  4. #4
    Join Date
    Aug 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    hi,
    i update the code u send me before can u check it please soi can begin testing
    Attached Files Attached Files

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Hi, Ahmed

    This subject in the SEARCH function of the Forum Gives 72 Hits ... including working programs for the 18B20

    so, just use it !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Aug 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    hi,
    no replies nothing work tell now i got blank screen

  7. #7
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Put here the schematic, please.

Similar Threads

  1. Reading temperature using multi DS18B20
    By KVLV in forum Code Examples
    Replies: 16
    Last Post: - 3rd November 2017, 19:48
  2. Please help with code for DS18B20
    By fratello in forum mel PIC BASIC Pro
    Replies: 109
    Last Post: - 28th April 2013, 21:12
  3. Help with DS18B20 program
    By presario1425 in forum mel PIC BASIC Pro
    Replies: 38
    Last Post: - 22nd August 2012, 00:50
  4. Multi DS18b20 Code help.
    By sccsltd in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2009, 06:13
  5. DS18B20 error reading
    By Gaetano in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th August 2007, 16:21

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