Please help with code for DS18B20


Closed Thread
Results 1 to 40 of 110

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink Check Hardware !

    Hi,

    That looks no pullups - or a Pulldown ! - on PORTA.0 input ... the " * " only appears when Porta.0 is tied to ground.

    Everything fine here ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    May 2008
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    That looks no pullups - or a Pulldown ! - on PORTA.0 input ... the " * " only appears when Porta.0 is tied to ground.

    Everything fine here ...

    Alain
    I thought that might be the problem, but where would I put
    high portA.0

    If I put it before the mainloop it displays the temperature all the time,
    if I put it at the end of mainloop then it still displays the * and stays on set temperature.

    I can't figure out where to put it, must be easy but I just cant see it.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by lew247 View Post
    I thought that might be the problem, but where would I put
    high portA.0

    If I put it before the mainloop it displays the temperature all the time,
    if I put it at the end of mainloop then it still displays the * and stays on set temperature.

    I can't figure out where to put it, must be easy but I just cant see it.

    May be you could place The pullup resistorS ( 3 x 47-100k ) between Porta.0,1 and 2 and VCC ...

    No need to place it inside the Pic ... that won't work !

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    May 2008
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Sorry Alain, I wasn't too clear on what I meant.

    The easypic board HAS pullup resistors on those ports.

    When i run the program, the lcd sits there with just the * displaying even when no button has been pressed (portA.0 in this circuit/program)

    it does nothing else.

    When I press portA.0 the display cycles through set temp (which I can set properly with portA.1 and portA.2)
    Next press brings it to the Hysteresis which again will set ptoperly

    the 3rd press brings up the temperature display mode (mode 0 )

    It displays the temperature at the moment the button is pressed but it never updates or checks again.

    I have checked it works by holding down the button on portA.0 and if held down (LOW) then the display works properly, measuring the temperature continious, and if the temp changes it makes port C.0 or C.2 high depending on the set temp and hysteresis.

    My problem is I cannot get it to continually measure temperatre without holding down portA.0

    Also when I turn the power on first all I get is the LCD blank other than * being displayed.

    Having read the code, * should only display after each button press, but it always displays.

    Also I'd like it when power is turned on to measure and show the temperature continoiusly until the button (portA.0) is pressed.


    Hope that made more sense, as I knew I couldn't put resistors inside the pic

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Very informative thread and funny enough something that I was hoping to work on myself as I'm looking at replacing the simple on/off thermostats that control the heating in my reptiles vivariums.

    Can someone (Alain?) post up a schematic for the project. (or settings for the EasyPIC5) - I'm looking at trying to develop this a bit further so the output is pulsed, with the mark / space ratio reducing as the set point is neared. I've used commercial on/off stats, and the temperatures are hard to control. The idea is to keep the hot spot fairly constant and below 35C max, as constant exposure to a surface above this temperature can cause a burn risk to snakes.


    With the thermometer probe placed on the shelf near the logger (it wasn't actually touching the same spot), and with the thermostats sensor in the cool part of the shelf, the thermostat was set so the digital thermometer read a max of 34C. Here's are the results - the bit you are interested in is between 18:00 hrs onwards



    Obviously the heat was conducting through the wood, which cooled slower than if the sensor was measuring air or the surface of the heater. But you can see that there is a large temperature swing between the min and max readings, and that the surface reached over 40C

    To reduce this difference I placed the two probes next to the logger directly above the heater. Here is the results, which still show the same cycling, but with a lower differential (average 5 degree C), but is more stable



    The pulse proportional stat reduces the cycling as it's not switching the heater on/off/on, it maintains a steady temperature by pulsing power to it thus the heater never cools.

    I could purchase a couple of commercial PP stats for around £100 (possibly less via mail order) but then where's the fun in that Now I know there are a lot of you experience programmers that have dabbled with PWM, so wonder if you would like to add your comments here.

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    In the set up below I used a commercial data logger to record the surface temp of the shelf over a 24 hr period.



    Although I had originally posted this in my post above, the forum software said I had more than 4 images ????

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Malcolm,

    Sounds like the perfect job for a PID loop.
    <br>
    DT

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Angry

    Quote Originally Posted by lew247 View Post
    Sorry Alain, I wasn't too clear on what I meant.

    The easypic board HAS pullup resistors on those ports.

    ...

    Hope that made more sense, as I knew I couldn't put resistors inside the pic
    Hi, Lew

    You have a HARDWARE misconfig somwhere on your board ...

    the program AT THE MOMENT, is running aboard my EasyPic5 ...

    Check pullup jumpers on Porta.0,1,and 2 : UP
    check buttons jumper : GND

    Nothing more nothing less ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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 : 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