what i meant was that i removed those lines of code. now im using the following which is without the other features i was planning to implement. below is the latest code.
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
highled var porta.1
lowled var porta.2
relayhigh var porta.3
relaylow var porta.4
up var portc.0
down var portc.1
sethighp var portc.2
setlowp var portc.3
maindisp var portc.4
highpt = 100
lowpt = 0
trisc= %00011111
trisa=%00000001
adcon1=%10001110
adcon0=%11000001
pause 100
lcdout $fe , 1
mode = 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
tempc=tempc/100
If tempc>=highpt then
high highled
high relayhigh
else
low relaylow
low lowled
endif
If tempc<=lowpt then
high lowled
low relaylow
else
low relayhigh
low highled
endif
return
main:
gosub gettemp
gosub getkey
if maindisp = 0 then mode = 1
pause 50
if sethighp = 0 then mode = 2
pause 50
if setlowp = 0 then mode = 3
pause 50
select case mode
case 1
write 0 , sethighp
pause 10
write 1 , setlowp
lcdout $fe , 1
Lcdout "TEMP = ",DEC tempc,$DF,"C"
case 2
lcdout $fe , 1
lcdout $fe , $80 , "High Setpoint:" , $fe , $c0 , dec highpt, $DF , "C"
if up = 0 then highpt = highpt + 1
pause 50
if down = 0 then highpt = highpt - 1
pause 50
if highpt>100 then highpt=100
pause 50
case 3
lcdout $fe , 1
lcdout $fe , $80 , "Low Setpoint:" , $fe , $c0 , dec lowpt, $DF , "C"
if up = 0 then lowpt = lowpt + 1
if down = 0 then lowpt = lowpt - 1
if lowpt>100 then lowpt=100
end select
goto main
im realy desperate to get this thing working guys....
Bookmarks