Does this make any sense? (Well to me it does) At the moment, nothing appears on the LCD. Please could somebody tell me what I need to add/delete to obtain success from this 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
tempc var word
tempc1 var word
Conv1 Con 4
Conv2 Con 82/100
mode var byte
keyin var byte
adval 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
main:
gosub checkdone
gosub getkey
checkdone:
if adcon0.2=1 then checkdone
adval.highbyte=adresh
adval.lowbyte=adresl
Lcdout $fe, 1
tempc = adval * Conv1
tempc1 = adval * Conv2
tempc = tempc + tempc1
pause 1000
return
getkey:
pause 50
keyin = portc
return
if maindisp = 1 then
write 0 , sethighp
pause 10
write 1 , sethighp
LCDOut "TEMP = ", dec(tempc / 10), ".", dec1 (tempc // 100), $DF , "C"
endif
if maindisp = 1 then
write 2 , setlowp
pause 10
write 3 , setlowp
LCDOut "TEMP = ", dec(tempc / 10), ".", dec1 (tempc // 100), $DF , "C"
endif
if sethighp = 1 then gosub setsetpointh
if setlowp = 1 then gosub setsetpointl
setsetpointh:
lcdout $fe , $80 , "High Sp=" , $fe , $c0 , dec highpt
if up = 1 then highpt = highpt + 1
if down = 1 then highpt = highpt - 1
return
setsetpointl:
lcdout $fe , $80 , "Low Pt=" , $fe , $c0 , dec lowpt
if up = 1 then lowpt = lowpt + 1
if down = 1 then lowpt = lowpt - 1
return
goto main
Bookmarks