I can see a number of defects in your code. In the subroutine 'Pressed:'... herein you have some ambiguous statements... the first is...
IF PORTA.3 = 0 Then setdelta
Since the next line is SETDELTA anyway, it seems a little pointless.
The next problem is your use of the pressed subroutine. You adjust the variable DELTA from 700 to 2000 (7 to 20 Celsius) in steps of 100 with a delay of three seconds between them… 13 steps x 3 seconds means the user waits 39 seconds… a little long I would have thought.
Then (this is your main problem) you are displaying the raw value of Delta with…
LCDOut $fe, 1, "Delta ", delta
Whereas you should have displayed…
#delta
The # symbol makes all the difference…
And the routine always sets Delta to 700 and counts up, wouldn't it be better to adjust from the last value of Delta and roll back to 700 once 2000 has been exceeded?
So, may I suggest the code is changed perhaps to something like...
. . .
PortA.3 var PressButton ‘ Define adjustment Button
. . .
Pressed:
LCDOut $FE,1,"Delta : ",#Delta
Pause 3000 ' Wait 3 seconds
PressedLoop:
If PressButton=1 then goto Mainloop
Delta=Delta+100
If Delta>2000 then Delta=700
LCDOut $FE,$88,#Delta," "
Pause 1000
Goto PressedLoop
Here we wait 3 seconds displaying the current value of Delta, thereafter if the button is still pressed we advance the value of Delta at a 1 second rate. Finally, NOT clearing the display, but simply overwriting the previous displayed value prevents the annoying flicker on the LCD.
Melanie
Bookmarks