So I am on track with this?
Timer counts up, sets the interupt. Interupt causes CounterA to advance by 1, which increments the digits for the display. Obviously, the segment drive logic is not there yet.
Tenths var word
Units var word
Tens var word
Hundreds var word
Thousands var word
Tenthousands vAR WORD
Gosub SetTimer ' Set the Timer
On Interrupt goto CounterA
PIE1.0=1 ' Enable TMR1 Interrupts
SetTimer:
T1CON.0=0 ' Stop the Clock
TMR1H=$AB ' Set Timer Highbyte
TMR1L=$A0 ' Set Timer Lowbyte
T1CON.1=1 ' Restart the Clock
PIR1.0=0 ' Reset TMR1's Interrupt Flag
Return
CounterA:
' Timer Interrupt Handler
' =======================
Gosub SetTimer ' Set the Timer for next count
Tenths=Tenths+1 ' Increment 1/10TH minute Counter
If Tenths>9 then
Tenths=0
Units=Units+1 ' Increment the Units
If Units>9 then
Units=0
Tens=Tens+1 ' Increment the Tens
If Tens>9 then
Tens=0
Hundreds=Hundreds+1 ' Increment the Hundreds
If Hundreds>9 then
Hundreds=0
Thousands=Thousands+1 'Increment the Thousands
If Thousands>9 then
Thousands=0
Tenthousands=Tenthousands+1 'Increment the Tenthousands
endif
endif
endif
endif
endif
endif
endif
Resume
End




Bookmarks