using the DS18B20


Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default using the DS18B20

    HI,

    I have been trying to make a DS18S20 work, I have used the code on Rentron to guide me.
    http://www.rentron.com/PicBasic/one-wire3.htm
    BUt what I get around 3000 degrees as my output.
    I basically took his code and removed the Fahrenheit calculation and put it on a LCDout command. with no minus temperature.
    shouldn't the command Div32 give me the temperature in Celcius directly ?

    ken


    Start_Convert:
    OWOUT Comm_Pin, 1, [$CC, $44]' Skip ROM search & do temp conversion
    Wait_Up:
    OWIN Comm_Pin, 4, [Busy] ' Read busy-bit
    IF Busy = 0 THEN Wait_Up ' Still busy..?, Wait_Up..!
    OWOUT Comm_Pin, 1, [$CC, $BE]' Skip ROM search & read scratchpad memory
    OWIN Comm_Pin, 2, [R_Temp.Lowbyte, R_Temp.Highbyte]' Read two bytes / end comms
    GOSUB Convert_Temp
    GOTO Start_Convert
    Convert_Temp:
    Sign = "+" Dummy = 625 * R_Temp ' Multiply to load internal registers with 32-bit value
    TempC = DIV32 10 ' Use Div32 value to calculate precise deg C
    Lcdout $fe, 1 'Clear screen
    Lcdout "Value: ", DEC TempC, Deg,"C " 'Display the decimal value
    RETURN
    END
    Last edited by lerameur; - 17th December 2006 at 13:30.

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