there are more problems here than i can count
1, timer3 has no clock source
2, how can ticks ever get beyond 100
Code:
main: LatB.1 = 1 ' Pulse heartbeat
IF Ticks > 100 THEN
LatB.0 = 0 ' End of interrupt
ENDIF
LatB.1 = 0 ' Reset heartbeat trace
GOTO Main
when
Code:
ClockCount: ' Note: this is being handled as an ASM interrupt
@ INT_START
@ RELOAD_TIMER ; Reload Timer3
R0save = R0 ; Save 2 PBP system vars that are used during
R1save = R1 ; the interrupt
Ticks = Ticks + 1
if Ticks = 100 then
Ticks = 0
IF CountDown THEN
3, a 16f18877 like all enhanced core pic16's has Auto context save
the entire int_start / int_return macros are inappropriate
4, you need to rethink that, that is for timer1 not 3
Code:
StartTimer:
IF NOT ZERO THEN
T3CON.1 = 0 ; (TMR3CS) Select FOSC/4 Clock Source
T3CON.3 = 0 ; (T3OSCEN) Disable External Oscillator
PIR4.0 = 0 ; (TMR3IF) Clear Timer3 Interrupt Flag
PIE4.0 = 1 ; (TMR3IE) Enable TMR3 overflow interrupt
INTCON.6 = 1 ; (PEIE) Enable peripheral interrupts
INTCON.7 = 1 ; (GIE) Enable global interrupts
T3CON.0 = 1 ; (TMR3ON) Start Timer3
ENDIF
return
Bookmarks