Another way that has no PAUSE statements, so has very quick
response to all inputs.
; Assumes 20 Mhz Oscillator
T0CON =$86
LOOP:
IF INTCON.2 = 1 THEN
INTCON.2 = 0
TMR0H = $69
TMR0L = $7A
GOSUB SecondsTimer
EndIF
'Run regular code here (check for inputs, timeouts, etc)
GOTO LOOP
SecondsTimer:
Seconds = Seconds + 1
IF Seconds >= 60 THEN
Seconds = 0
Minutes = Minutes + 1
IF Minutes >=60 THEN
Minutes = 0
Hours = Hours + 1
ENDIF
ENDIF
RETURN
END




Bookmarks