DS18s20 - negative teperature


Closed Thread
Results 1 to 6 of 6
  1. #1
    Ceug2005's Avatar
    Ceug2005 Guest

    Default DS18s20 - negative teperature

    WHAT IS WRONG HERE ?!
    i heave 2 sensors DS18S20 in one wire network , 4,7 k resitor pullup,
    3 wires / Vcc = 5V , GND, data



    1.with positive temerature works OK.
    2.with negative teperature around 0°c is jumping from -655.11 to +88.xx , then i heave right data ,after some time is jumping again and again .....or is jumping from -655.11 to right data and back.


    PIC16F877 AT 4 MHZ
    -------------------------------

    count_remain_0 Var Byte ' sensor 0
    count_per_c_0 Var Byte ' sensor 0
    count_remain_1 Var Byte ' sensor 1
    count_per_c_1 Var Byte ' sensor 1
    TempC0 VAR WORD ' RAW Temperature readings sensor 0
    R_Temp0 VAR WORD ' RAW Temperature readings sensor 0
    TempC1 VAR WORD ' RAW Temperature readings sensor 1
    R_Temp1 VAR WORD ' RAW Temperature readings sensor 1
    Deg CON 223 ' Data to display Deg ° symbol
    Sign0 VAR BYTE ' +/- sign for temp display sensor 0
    Sign1

    '-------------------------------
    .
    .
    .

    '-------------------------------
    'sensor 0
    OWOUT PortB.0, 1, [$55,$10,$BB,$40,$2C,$00,$08,$00,$F9, $44] ' match ROM & do temp conversion
    pause 50
    OWOUT PortB.0, 1, [$55,$10,$BB,$40,$2C,$00,$08,$00,$F9, $BE] ' match ROM & read scratchpad memory

    OWIN PortB.0, 2, [R_Temp0.Lowbyte, R_Temp0.Highbyte,skip 4,count_remain_0,count_per_c_0] '

    if R_Temp0.bit9 = 0 then 'temp pozitive
    sign0="+"
    TempC0 = (((R_Temp0>> 1) * 100) - 25) + (((count_per_c_0 - count_remain_0) * 100) / count_per_c_0)

    else
    sign0="-" 'temp negative
    R_Temp0 = R_Temp0.lowbyte ^%11111111
    R_Temp0 = R_Temp0.lowbyte + 1
    R_Temp0 = R_Temp0.lowbyte>> 1

    TempC0 = (((R_Temp0>> 1) * 100) - 25) + (((count_per_c_0 - count_remain_0) * 100) / count_per_c_0)
    endif

    lcdout $FE , 1 ,sign0,DEC TEMPC0 DIG 3,DEC TEMPC0 DIG 2 ,".",DEC TEMPC0 DIG 1,DEC TEMPC0 DIG 0 ,Deg,"C","

    ....

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    have a look on this link
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Ceug2005's Avatar
    Ceug2005 Guest


    Did you find this post helpful? Yes | No

    Talking

    Ohhh Ty Steve.

    If you want to buy a pizza , i dont send you to rent a car.

    i ask what is wrong not to use DIV32 with DS18B20.
    like you see i use DS18s20.

  4. #4
    anj's Avatar
    anj Guest


    Did you find this post helpful? Yes | No

    Default

    One thing to watch out for when reading a DS18s20 is that they slow down with colder temps

    The max timeout they specify to do a temp conversion is 750ms. Reading data before that can result in corruption
    Yr code has
    OWOUT PortB.0, 1, [$55,$10,$BB,$40,$2C,$00,$08,$00,$F9, $44] ' match ROM & do temp conversion
    pause 50
    OWOUT PortB.0, 1, [$55,$10,$BB,$40,$2C,$00,$08,$00,$F9, $BE] ' match ROM & read scratchpad memory

    thus you are only allowing 50ms.
    Setting this higher, or using a loop to check for the "done" bit being set will probably stabilise it at the lower temps.

  5. #5
    Ceug2005's Avatar
    Ceug2005 Guest


    Did you find this post helpful? Yes | No

    Lightbulb

    TY anj

    all works fine with 750 - 800 ms.
    And in AC Electrical caracteristics - data sheet is specified

    " t_CONV max 750 ms ".


    TY again

  6. #6
    Ceug2005's Avatar
    Ceug2005 Guest


    Did you find this post helpful? Yes | No

    Default

    ds1820-report.pdf by Dalas semi
    Attached Images Attached Images

Similar Threads

  1. negative pulse I/O pin how to?
    By rickyD in forum General
    Replies: 11
    Last Post: - 13th June 2008, 06:48
  2. DS18S20 reading negative temperature
    By srob in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th December 2007, 22:21
  3. DS18S20 displays wrong temperatures
    By Shozo Kanamori in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th August 2007, 04:18
  4. Reading (ADC) negative current
    By sougata in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st November 2006, 18:38
  5. 16F877, DS18S20 and Serial Comm Problem
    By YellowTang in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2004, 11:36

Members who have read this thread : 1

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