Please help with code for DS18B20


Closed Thread
Results 1 to 40 of 110

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    i have been trying to simulate the circuit on the proteus and also trying to make it work on the test board.

    On the simulation i have some result but on the test board i dont get anything on the lcd.

    Unfortunately with the code from Elektor i get some results on the lcd on the test board. But very wrong result like 234 oC.

    Could someone upload the hex file from Mr. Fratello's #35? Could anyone made it work?

  2. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    but i need your advice according to the second sensor please.
    could you please help me out to finish the schematic?
    The second sensor (and the third, forth, fifth, etc, etc.) simply goes in parallel with the first... see example below.

    Name:  2011-09-25_074625.jpg
Views: 4740
Size:  39.5 KB

    The PIC's job is to address each individual sensor to read its value. That is how the One-Wire bus works. Each sensor has an address and will only respond to it's address.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    Quote Originally Posted by Heckler View Post
    Each sensor has an address and will only respond to it's address.
    Yes. right !!! In my code I put the individual code of each sensor . For working with ANOTHER sensors, first you need to read the address of each sensor and then modify the code. You can find some examples on this forum...

  4. #4
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    hello,

    thanks for the answer. i use the DS18B20, so i dont need to do any modification.

    The problem is that i cannot see anything on the display. It looks like something is really wrong inside the code.

    I think that i make the mistake on the code or the circuit above.

    1) does this schematic corresponds to the code? (i need to put one more sensor)
    2) do i need to do anything inside the code

    for example in the following lines do i need to chose one of these?

    ;DS18B20_9bit CON %00011111 ; 93.75ms, 0.5°C
    ;DS18B20_10bit CON %00111111 ; 187.5ms, 0.25°C
    ;DS18B20_11bit CON %01011111 ; 375ms, 0.125°C
    ;DS18B20_12bit CON %01111111 ; 750ms, 0.0625°C (default)
    DS18B20_1_12bit CON %01111111 ; 750ms, 0.0625°C
    ;DS18B20_2_12bit CON %01111111 ; 750ms, 0.0625°C


    But still i dont see anything on my lcd.

  5. #5
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    To be more specific,

    as i understand i need to find the unique ID from each sensor and then modify it on the code.

    First i need to solve an other problem, what about i dont see anything on the display?

    Shouldnt i see some 'no sensor' or like that at least?

  6. #6
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    Yes, it's right what you say in post #71 !
    Put this in top of code :
    Code:
    @ DEVICE pic16F628A, intOSC_osc_noclkout, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON
    define osc 4
    REMOVE Xtal and caps (no need quartz precision) ; or keep it - but then replace "Intosc_osc_noclkout" with "XT_Osc".
    Now you MUST have something on display !
    Last edited by fratello; - 25th September 2011 at 18:38.

  7. #7
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    i've tried it but nothing on the lcd again,

    i think it has to do with the osc commands and there is the problem.

    i put a 4mhz ceramic with two legs, i idid also tried the ceramic 4mhz with 3 legs. Nothing on the screen.

    i'm sad that cannot complete it.

    thanks a lot for your help! am i doing something wrong with the schematic? Do i need anything else?

    The code from the elektor works, but i dont have the ds1820. And it is on the screen xxx.xx

    But i dont understand why it does not work with your code.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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