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