The timer continues counting no matter what the program is doing.
And yes, it does take time to save all the PBP system registers before it gets to the interrupt handler.
But that has no affect on the reload value.
Your problem before was that you were overwriting the timers value with TMR1L = 0.
Here is the program I used with the Digital Clock Generator shown above, and it does keep perfect time.
Code:;-------------------------------------------------------------- wsave VAR BYTE $70 SYSTEM INCLUDE "DT_INTS-14.bas" ; Base Interrupt System INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR1_INT, _Clock, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM @ INT_ENABLE TMR1_INT ; enable external (INT) interrupts ;-------------------------------------------------------------- Sec VAR BYTE Minute VAR BYTE Hour VAR BYTE SecChanged VAR BIT ;-------------------------------------------------------------- ADCON1 = 7 TMR1L = 0 TMR1H = $80 T1CON = %00001011 PAUSE 250 LCDOUT $FE,1 ;-------------------------------------------------------------- Main: IF SecChanged THEN SecChanged = 0 LCDOUT $FE,$80, DEC2 Hour,":",DEC2 Minute,":",DEC2 Sec ENDIF GOTO Main ;-------------------------------------------------------------- Clock: TMR1H.7 = 1 Sec = Sec + 1 SecChanged = 1 IF Sec = 60 THEN Sec = 0 : Minute = Minute + 1 IF Minute = 60 THEN Minute = 0 : Hour = Hour + 1 IF Hour = 24 THEN Hour = 0 @ INT_RETURN







Bookmarks