Onewire.pbp sample program -- high readings


Closed Thread
Results 1 to 5 of 5
  1. #1

    Default Onewire.pbp sample program -- high readings

    This program --

    http://melabs.com/samples/PBP-mixed/onewire.htm

    works fine but at room temperature I'm getting --
    178 C
    350 F

    I am using a probe with a DS18B20 sensor, perhaps that's it but I can't imagine why, the temperature storage is word and I read where the DS18 B 20 has higher resolution?

    Anyway, can anyone see why I'm getting these high readings?

    I simply did a copy and paste with the code -- didn't change a thing. -- Thanks.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Onewire.pbp sample program -- high readings

    a ds18b20 is not a ds18s20 , the code you linked is for a ds18s20. check the data sheets

    a ds18b20 does not have or use count_remain, count_per_c at all. there are plenty of examples for either device in the forum but
    some do not explicitly state which device they match. caveat emptor


    check these scratch pad definitions
    Attached Images Attached Images   
    Warning I'm not a teacher

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Onewire.pbp sample program -- high readings

    This works for me using DS18B20

    Code:
    DQ                 VAR PORTA.5          'One-wire data pin for Ds18B20
    GIE             VAR INTCON.7
    temperature     VAR     WORD            ' Temperature storage
    
    '*******************************************************************************
    'Get and display the temperature
    GIE = 0                                 
    owin DQ, 1, [],NoDevice                 ' pole 1 wire bus - if no responce then device not pressent
    OWOUT DQ, 1, [$CC, $44]                 ' Start temperature conversion
    OWOUT DQ, 1, [$CC, $BE]                 ' Read the temperature
    OWIN DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE]
    GIE = 1                                 ' turn interupts back on
    temperature = temperature */ 1600 
    lcdout $FE,$D4+0,"TEMP ",dec(temperature / 100),$DF,"C"
    
    
    NoDevice:
    lcdout $FE,$D4+0,"TEMP N/C   "
    GIE = 1
    goto main

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Onewire.pbp sample program -- high readings

    Ok thanks much -- didn't notice the "S".



    I looked at this --

    https://www.maximintegrated.com/jp/a...ex.mvp/id/4377

    and I see the difference in the memory map, but can the example --

    http://melabs.com/samples/PBP-mixed/onewire.htm

    be easily adapted to work with the 18B20 maybe? Just want to get this going.

    I just did a search for DS18S20 probe and it also shows it as DS18B20. And yet, you're saying they are not the same animal. ? These listings seem to think they're the same. (!) wrong ?

    https://www.ebay.com/sch/i.html?_fro...probe&_sacat=0


    I'll try your code Scampy -- thanks. Would like to be able to modify the melab sample though as I have it inside some other code and a complex breadboard already setup.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Onewire.pbp sample program -- high readings


Similar Threads

  1. LCD -- melabs sample program
    By Michael in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 19th June 2017, 13:42
  2. Lcd 16x2 circuit and sample program...
    By larzazral in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd July 2012, 11:21
  3. unstable ADCIN readings when using DT ELAPSED.PBP
    By peter_wiersig in forum General
    Replies: 8
    Last Post: - 27th February 2010, 19:16
  4. DS2438 onewire code sample
    By Captain Stern in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st January 2007, 02:47
  5. DS1307 sample Program
    By Mark in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th September 2004, 02:25

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