Please help with code for DS18B20


Results 1 to 40 of 110

Threaded View

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

    Default Please help with code for DS18B20

    I made the great project of "Digital thermostat (080090-11)" from Elektor july_august 2008 ; unfortunate I do not have DS1820 but DS18B20. The temperature show on display is like "xxx.xx 'C" !.
    I read this : "In order to convert the HEX code to a temperature value, first you need to identify if you are using a DS18S20, or DS18B20 series sensor. The code to read the temperature needs to be slightly different for the DS18B20 (and DS1822), because it returns a 12-bit temperature value (0.0625 deg precision), while the DS18S20 and DS1820 return 9-bit values (0.5 deg precision)".
    I try millions different routines, but the result is verry bad...because of this section, I think :
    "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"
    All the codes I try change the Temperature set and Hysteresis, and the display show the temperature (ex. 24.56'C) , but useless function of thermostat...(Set temperature = 2000.00 and Hysteresis = 200.00).
    And the temperature is different (+24.67 'C) by other device (DS18B20 + PIC 12F675 + LCD Nokia = 23.1'C ; LM35DZ + mV = 23.1 'C)
    It is possible to increase the accuracy of this thermometer/thermostat ?
    Can somebody help me to modify the source for using DS18B20 ?
    Thanks in advance !
    Attached Files Attached Files
    Last edited by fratello; - 30th December 2008 at 11:00.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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