Don't know what PIC you're using...so don't really know if that PIC has onchip eeprom or not...or what...
Code:
Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTB
Define LCD_RSBIT 5
Define LCD_EREG PORTB
Define LCD_EBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
mode var byte : keyin var byte : adval var word : tempc var word
highpt var byte : lowpt var byte : up var portc.0 : down var portc.1
sethighp var portc.2 : setlowp var portc.3 : maindisp var portc.4
trisc=$ff : trisa=$ff : adcon1=$82 : adcon0=$c1 : pause 100
mode = 1 : lcdout $fe , 1 : goto main
getkey: pause 50 : keyin = portc : return
gettemp: adcon0.2=1 : pause 1
checkdone: if adcon0.2=1 then checkdone
adval.highbyte=adresh : adval.lowbyte=adresl : tempc=(50*adval)/100 : return
main: gosub gettemp : gosub getkey
if maindisp = 1 then
write 0 , sethighp : pause 10 : write 1 , sethighp : mode = 1
endif
if sethighp = 1 then mode = 2
if setlowp = 1 then mode = 3
select case mode
case 1
lcdout $fe , $80 , "Temp = ", DEC3 tempc , $DF , "C"
case 2
lcdout $fe , $80 , "High Pt=" , $fe , $c0 , highpt
if up = 1 then highpt = highpt + 1
if down = 1 then highpt = highpt - 1
case 3
lcdout $fe , $80 , "Low Pt=" , $fe , $c0 , lowpt
if up = 1 then lowpt = lowpt + 1
if down = 1 then lowpt = lowpt - 1
end select
goto main
If that doesn't give you some ideas...nothing will...
But remember, I SUCK! DUDE!
P.S. Your program has been COLONized! In the process of De-COLONizing the code above and figuring out what goes where, you might learn something...
Bookmarks