back to the drawing board
OK something has really got screwed up....
Here's the menu routine which is used to set the times for the lighting
Code:
Lighting:
Lighton:
Lcdout $FE,2
LCDOUT $FE,$80,"Set On Time For "
IF H_butt = 0 THEN GOSUB IncHours
IF M_butt = 0 THEN GOSUB IncMinutes
lightsetHR[fn]=Hours
lightsetMN[fn]=Minutes
if viv >=2 then viv =2
LCDOUT $FE,$C0,"Light Circuit ",#viv
lcdout $FE,$94,#lightsetHR[fn] DIG 1,#lightsetHR[fn] DIG 0,":",#lightsetMN[fn] DIG 1,#lightsetMN[fn] DIG 0
pause 200
If S_butt = 0 then
pause 250
fn = fn +1
viv = viv+1
hours = 0
minutes = 0
endif
If fn > 1 then
LCDOUT $FE,1
viv=1
fn=0
goto lightoff
endif
goto lighton
lightoff:
Lcdout $FE,2
LCDOUT $FE,$80,"Set Off Time For "
IF H_butt = 0 THEN GOSUB IncHours
IF M_butt = 0 THEN GOSUB IncMinutes
lightoffHR[fn] = Hours
lightoffMN[fn] = Minutes
if viv >=2 then viv =2
LCDOUT $FE,$C0,"Light Circuit ",#viv
lcdout $FE,$94,#lightoffHR[fn] DIG 1,#lightoffHR[fn] DIG 0,":",#lightoffMN[fn] DIG 1,#lightoffMN[fn] DIG 0
pause 200
If !S_butt then
pause 250
fn = fn +1
viv = viv +1
hours = 0
minutes = 0
endif
If fn >=2 then
LCDOUT $FE,1
goto mainmenu
endif
goto lightoff
so I added the following lines to display the times on the LCD when the program is running
Code:
lcdout $FE,$D4+8,#lightsetHR[fn] DIG 1,#lightsetHR[fn] DIG 0,":",#lightsetMN[fn] DIG 1,#lightsetMN[fn] DIG 0
lcdout $FE,$D4+14,#lightoffHR[fn] DIG 1,#lightoffHR[fn] DIG 0,":",#lightoffMN[fn] DIG 1,#lightoffMN[fn] DIG 0
setting the time on to 00:00 and the off time to 00:01 the LCD displays 00:50 and 01:00 respectively. So obviously DT's routine will never match the times set..... I don't know why this has happened because in the original code it matched perfectly.... :(