18B20 temperature sensor and PIC


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    39

    Default 18B20 temperature sensor and PIC

    Hello, does anyone has an experience with the 18B20 temperature sensor? I have big problem, that the temperature measured with this sensor is approx. by 5 degrees celsius bigger, than the reality. Dont know why. Here is the part of code, whic I am using to compute the temperature:

    OWOUT HEATING_SENSOR, 1, [$CC, $44] 'Skip ROM search & do temp conversion
    Wait_Up:
    OWIN HEATING_SENSOR, 4, [Busy] 'Read busy-bit
    IF Busy = 0 THEN goto Wait_Up 'Still busy..?, Wait_Up..!
    OWOUT HEATING_SENSOR, 1, [$CC, $BE] 'Skip ROM search & read scratchpad memory
    OWIN HEATING_SENSOR, 2, [TEMP1_WORD.Lowbyte, TEMP1_WORD.Highbyte] 'Read two bytes to Temp1_word variable
    CURRENT_TEMPERATURE = (TEMP1_WORD / 16)*10 'resolution is 16
    TEMP1_BYTE = TEMP1_WORD // 16 'store temporarilly remainder
    lookup TEMP1_BYTE, [0,0,1,1,2,3,3,4,5,5,6,7,7,8,9,9,9], TEMP2_BYTE
    CURRENT_TEMPERATURE = CURRENT_TEMPERATURE + TEMP2_BYTE / here is the temperature value e.g. for 23,8 degrees celsius in this variable is 238

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    What reading do you get when you put the sensor in a glass of ice water?

  3. #3
    Join Date
    Aug 2006
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Solved

    Hello, thanks for the answer. I finally found, what was the problem. The sensor was connected very close to the stabiliser 7805, which produced the temperature, and if even the sensor was outside the box, the temperature has been injected to it via the cu wires ( approx 1 cm ). So just I replaced the cu wires with the normal one and make them longer ( approx. 10 cm ) and the problem is not there any more. Thanks, Robert

Members who have read this thread : 2

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