temp var word
temperature var word
samples var word
sample VAR BYTE
quanta con 1250
Tmax VAR byte
Tmin VAR byte
Read 0,DatoEE
Tmin=DatoEE
Read 1,DatoEE
Tmax=DatoEE
temp = 0 'Clear temp register
temperature = 0 'Clear temperature register
sample = 0 'Clear sample register
samples = 0 'Clear samples register
FOR sample = 1 TO 20 'Take 20 samples
ADCIN 0, temp 'Read AN0 into temp variable
samples = samples + temp
PAUSE 50 ' Wait 1/4 seconds per reading
NEXT sample
temp = samples/20 'Average over 20 samples (Every 5 seconds)
temperature= (temp*10) */ quanta
Pause 200 ' Timeout for LCD to settle
LCDOUT $FE, 1 ' cancella LCD
LCDOUT $FE, 2 ' ritorna al primo carattere
lcdout $FE, 2, "Temp ",dec2 (temperature/100),".", dec1 (temperature//100),$DF,"C"
lcdout $FE, $C0, "Tmin ",#Tmin DIG 1,#Tmin Dig 0," Tmax ",#Tmax DIG 1,#Tmax Dig 0
If temperature > Tmax then
PORTA.6=1
Endif
Bookmarks