Hi C.C.,
this might be an opportunity to use select case.
I noticed you are using IF THEN to direct functions for each state or your PortA.2 inputs, why not use ELSE ?
Code:
main:
If PortA.2 = 0 then
gosub waterok
ELSE
Gosub Waterbad
if PORTA.6 = 1 then ' assumes you have pulldown resistor
GOSUB tempdown
if PORTA.7 = 1 then 'assumes you have pulldown resistor
GOSUB tempup
ENDIF
endif
endif
goto main
waterok:
lcdout $fe, $c0+13, " OK"
return
waterbad:
lcdout $FE,$c0+13, " NASTY"
return
tempdown:
lcdout $fe, $80+0, "TEMP DOWN "
RETURN
tempup:
lcdout $fe, $80+0, "TEMP UP "
RETURN
END
HTH
JS
Bookmarks