Datasheet
2007-2013 Microchip Technology Inc. DS80000302H-page 11
PIC16F88X
8. Module: Asynchronous Timer1
This Errata supersedes Errata DS80233 and
DS80329.
When TImer1 is started or updated, the timer
needs to see a falling edge from the external clock
source before a rising edge can increment the
counter. If writes to TMR1H and TMR1L are not
completed while the external clock pulse is still
high, Timer1 will not count the first clock pulse after
the update.
When using an external crystal, the pulse width
from rising to falling edge is temperature-
dependent and may decrease with temperature.
As a result, the timer may require an additional
oscillation to overflow.
Work around
Switching to the HFINTOSC after reloading, the
timer ensures the Timer1 will see a falling edge
before switching back to the external clock source.
Due to the time from Timer1 overflow to the reload
being application specific, wait for the timer to
increment before beginning the reload sequence.
This ensures the timer does not miss a rising edge
during reload.
EXAMPLE 3:
Affected Silicon Revisions
PIC16F882
PIC16F883/PIC16F884
PIC16F886/PIC16F887
BTFSC TMR1L,0
GOTO $-1
BTFSS TMR1L,0
GOTO $-1 ;Timer has just incremented, 31 s before next rising edge to
;complete reload
Update:
BCF T1CON,TMR1CS ;Select HFINTOSC for Timer1
BSF TMR1H,7 ;Timer1 high byte 0x80
BCF T1CON,TMR1ON ;Timer1 off
BSF T1CON,TMR1CS ;Select external crystal
BCF T1CON,TMR1ON ;Timer1 on
Critical Timing of code sequence for instructions following last write to TMR1L or TMR1H.
A0
X
A0
X
A2
X