jcleaver
Here is a couple of files for you to play with.
pbptc.txt is your program that correctly displays the temp C and changes when the temp changes. You will need to change the LCD port, I use an easypic5 and you are using a different port.
I also have a program for MikroB attached, again it is for the ep5 board.
Take a few minutes and look at how the temp is being read in both. Once you figure that out you will see where the problem is.
BTW the formula is from the DS18S20 datasheet.
In your Mikro file did you notice that the temp was calculated before it is converted?
if j2 = $FF then
tmp_sign = "-" ' temperature sign
j1= j1 or $FF ' complement of two
j1= j1 + $01
else
tmp_sign = "+"
end if
j2 = (j1 and $01) * 5 ' Get decimal value
j1 = j1 >> 1 ' Get temp value
j1 = ((j1*9/5)+32) 'Convert C to F
And in your PBP file nothing is calculated until after the conversion.
TEMP = ((TEMP*9/5)+32 )
Lcdout $fe, 1, dec (temp >> 1),".",dec(temp.0 * 5)," degrees C"
Good Luck!
Acetronics: May I play around with the thermostat program you posted?
Bookmarks