Dallas one-wire question


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006
    Posts
    89

    Default Dallas one-wire question

    Hello again. I am dealing with a dallas one-wire temp sensor. I have used rentron electronics pages as a reference. I know how to poll the temp sensor to get its address. In my app, I need the the pic (16f876a with 20mhz) to poll it automatically without have to be hardcoded into the program. Here is what I have done so far:

    OWOUT DQ, 1, [$33]
    OWIN DQ, 0, [STR ID\8] this should place the address in the array.

    Then to use the temp sensor:

    OWOUT D, 1, [$55,str ID\8,$44]
    w1:
    OWIN D, 4, [Stat]' Check for still busy converting
    IF Stat = 0 THEN W1' Still busy?, then loop
    OWOUT D, 1,[$55,str ID\8,$BE]
    OWIN D, 2, [Temp.LOWBYTE,Temp.HIGHBYTE]' Read two bytes, then end communications
    IF Temp.bit15 = 1 THEN Below_32 ' Check for temp below 0°C

    this code is straight off of Bruce's website (great site by the way). When the pic is fired up, the lcd outputs a temp of 32.32F with obviously is not correct. Any ideas? Thanks.

  2. #2
    Join Date
    Apr 2006
    Location
    France
    Posts
    2


    Did you find this post helpful? Yes | No

    Default One wire temp sensor routines

    Hi there,

    Which Dallas 1 wire sensor are you using ? The DS18x20 type or iButton types.
    Also do you plan on having more than one on the 1 wire bus ?

    If there is only one device on the bus you so not need the devices ROM code but can use the "Skip ROM"(CCh) command instead of "Match ROM"(55h). If there is more than one device on the bus you will have to do a full search ROM routine to get the ROM code of the device you want to use.

    There is also the question of "strong pull-up" if the device is a DS18x20 type if in parasite power mode or a DS1920 iButton type which is always in parasite mode. In parasite mode you have to pull the bus up to 5 volts during the time the conversion takes place. I use a P-channel MOSFET controled by one of the PortB outputs to do the strong pull-up. The strong pull-up routine is time based since no information can be taken from the bus when it is turned on.

    There is also a difference between the DS18B20 and DS18S20 as to the resolution. The DS18S20 is 9 bit resolution while the DS18B20 can be set from 9 to 12 bit resolution. The DS18B20 comes on with the default valuse set to 12 bit resolution.

    From the value of "32.32F" it sounds like the device is not answering at all and the "Temp" is just returning all 0.

    Let me know just what your configuration is.

    Jim

  3. #3
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Dallas One wire

    There will only be one sensor on the line. It is not set on parasitic power. The model is ds18b20. I noticed the skip rom command in your post but must have entirely missed it in the datasheet. I am going to play with that for a while. Thanks.

Similar Threads

  1. Dallas CRC8 Routines
    By Tom Estes in forum Code Examples
    Replies: 23
    Last Post: - 8th May 2018, 18:07
  2. 1 Wire Search Routine
    By Dave in forum Code Examples
    Replies: 3
    Last Post: - 4th March 2016, 07:39
  3. dallas ibutton to pics
    By CBUK in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 25th October 2006, 12:55
  4. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49
  5. Dallas 1-wire search Routine
    By jimbab in forum Code Examples
    Replies: 0
    Last Post: - 7th April 2006, 16:14

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