I have been racking my brains trying to get a output to go high if the temp falls below a certian degree but just cant quite figure it out. I am using a modified version of Bruces DS18B20 code that I found on here (Sorry I forgot who it came from, was a while ago I found it) and heres what I have:
Code:
 Start:
sensor= TEMPSENSOR      ' i have 5 DS18B20    
GOSUB GetID              'go look up each sensors address
ID[hexbyte]=col         'load the ID array with the retrieved address byte
    NEXT hexbyte        ' get the rest of the address bytes
    OWOUT DQ, 1, [$55,STR ID\8,$44] 'match[$55] this[ID] rom code and
                                                    'initiates[$44] temperature conversion on matching sensor
    CkAgn:
    OWIN DQ, 4, [Busy]                     ' Check for still busy converting
    IF Busy = 0 THEN CkAgn               ' Still busy?, then loop
    OWOUT DQ,1,[$55,STR ID\8,$BE]   'instructs sensors to match[$55] this[ID] and start sending back scratchpad[$BE]
    OWIN DQ, 2, [Raw.LOWBYTE,Raw.HIGHBYTE]          ' Read two temperature bytes, then end communications
    Dummy = 1125 * Raw
    TempF = DIV32 100
     MTtemp = TempF
        MTtemp = (MTtemp + 3200) + tankoffset     
    SEROUT2 TX, 84, [DEC MTtemp DIG 3,DEC MTtemp DIG 2,".",DEC2 MTtemp,$DF,"F"]
return
I want to be able to take the MTtemp and compare it to a number like 78 (78 is the var for "setpoint" var Byte)
I have tried along with tons of other ways to get it to work, but basically what I am trying to do is:
Code:
MTtemp >>4
if MTtemp <= setpoint then
high heater
else
low heater
endif
There are so many ways I have tried this, just need a little push in the right direction...
Thanks!