Please help with code for DS18B20


Closed Thread
Results 1 to 40 of 110

Hybrid View

  1. #1
    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...

  2. #2
    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.

  3. #3
    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?

  4. #4
    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 19:38.

  5. #5
    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.

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    First you need to prove the pic is running. There are no caps shown in above schematic at the xtal, do you have caps on it? Have you made a led blink? Did you try internal osc?

    From the quick skim I did on this thread, it seems I have read several posts claiming the code works. Time to look at your hardware.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  7. #7
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    ok i will try later this afternoon to blink an led.

    Do i need capacitors for the ceramic 4 mhz resonator? I have also used a ceramic with 2 legs resonator at 4 mhz.

    In any case i will try to blink an led.

    As i mentioned on my previous posts, i have tried also the code from elektor, and works. (i just dont have the right sensor DS1820 which is very old and i dont get the right results. but i have something in the screen at least.

    With the code from Mr. Fratello, i dont have anything on the screen. That mean that there is something wrong, either with the hardware or software.

    Thank a lot again for your help.

Similar Threads

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

Members who have read this thread : 3

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