Michael, it might be handy if you posted all your code so we could see how the rest of it is meant to work - you need to use the [ CODE ] and [ / CODE ] (with out spaces inside the brackets) to make it clearer.
I use the following to read a DS18B20 temperature probe and display the temperature on an LCD. I then have the routine below to trigger a pin that drives a fan when the temperature exceeds a set value - you could always change the > for < to trigger the condition you want
Code:'******************************************************************************* 'Get and display the temperature GIE = 0 ' turn off interupts owin DQ, 1, [],NoDevice ' pole 1 wire bus - if no responce then device not pressent OWOUT DQ, 1, [$CC, $44] ' Start temperature conversion OWOUT DQ, 1, [$CC, $BE] ' Read the temperature OWIN DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE] GIE = 1 ' turn interupts back on temperature = temperature */ 1600 lcdout $FE,$D4+0,"TEMP ",dec(temperature / 100),$DF,"C" '******************************************************************************* ' fan:'check to see if fan is needed fantrigger=fanset if (temperature / 100)> fantrigger then high portA.4 endif




Bookmarks