DS18B20 thermostat


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Dec 2011
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Re: DS18B20 thermostat

    You are absolutely right falingtrea, I just figured that out. Several things I was doing wrong and will explain later, but right now I am taking my wife out to dinner.
    Thanks!

  2. #2
    Join Date
    Dec 2011
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Re: DS18B20 thermostat

    Ok, many many things I did wrong here. First was that I was trying to shift it >>4 to get the number in the lowbyte then trying to compare. Now the code is:
    Code:
     MTtemp = (MTtemp + 3200)
     IF MTtemp/100 <=  HeaterSetTemp THEN 
    HIGH MainHeater
    ELSE
    LOW MainHeater
    ENDIF
    I figured since I was trying to compare a word (data from DS18B20) to a byte (HeaterSetTemp) that I should shift the data >>4 and put it in the lowbyte then compare, but since I'm not working with a negative tempature reading I guess it doesn't really matter since all the leading bites are all zeros. The values displayed on the LCD was let’s say: MTtemp=6610 which is 66.10*F. I divided by10 to get rid of the .10 then compaired to 78 (HeaterSetTemp). Works perfect! The other problem was... it seems that I forgot to set the HeaterSetTemp variable to point to anything, so the HeaterSetTemp that was displayed was 146. I don't know where that came from since after looking at the code the HeaterSetTemp var was not pointed to anything, I would think it should have showed "0". For testing I did:
    Code:
    HeaterSetTemp = 78
    I thank you to both Ioannis and falingtrea for forcing me to display the data to see what I was dealing with. I should have done that in the first place and I knew that, but I guess I was looking for and easy fix, as a manager for a team of technicians I am huge on proper diagnosing and preach it all the time... but I failed to follow my own words this time.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default Re: DS18B20 thermostat

    No problem. Glad you did solve it.

    Ioannis

Similar Threads

  1. 4 Channel Thermostat using PID loops
    By malc-c in forum Code Examples
    Replies: 36
    Last Post: - 18th March 2013, 10:17
  2. Thermostat for refrigerator
    By fratello in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th August 2012, 22:58
  3. Thermostat
    By koossa in forum Off Topic
    Replies: 15
    Last Post: - 16th November 2010, 10:06
  4. Pulse proportional thermostat
    By malc-c in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th December 2009, 02:00
  5. using the DS18B20
    By lerameur in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2006, 13:09

Members who have read this thread : 0

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