Microchip Technology ARD00385 Data Sheet

Page of 570
 2009-2011 Microchip Technology Inc.
DS39957D-page 189
PIC18F87K90 FAMILY
13.2
Timer1 Operation
The Timer1 module is an 8 or 16-bit incrementing
counter that is accessed through the TMR1H:TMR1L
register pair.
When used with an internal clock source, the module is
a timer and increments on every instruction cycle.
When used with an external clock source, the module
can be used as either a timer or counter. It increments
on every selected edge of the external source.
Timer1 is enabled by configuring the TMR1ON and
TMR1GE bits in the T1CON and T1GCON registers,
respectively.
When SOSC is selected as a Crystal mode (by
SOSCEL), the RC1/SOSCI/ECCP2/P2A/SEG32 and
RC0/SOSCO/SCLKI pins become inputs. This means
the values of TRISC<1:0> are ignored and the pins are
read as ‘0’.
13.3
Clock Source Selection
The TMR1CS<1:0> and SOSCEN bits of the T1CON
register are used to select the clock source for Timer1.
 displays the clock source selections.
13.3.1
INTERNAL CLOCK SOURCE
When the internal clock source is selected, the
TMR1H:TMR1L register pair will increment on multiples
of F
OSC
, as determined by the Timer1 prescaler.
13.3.2
EXTERNAL CLOCK SOURCE
When the external clock source is selected, the Timer1
module may work as a timer or a counter.
When enabled to count, Timer1 is incremented on the
rising edge of the external clock input, T1CKI. Either of
these external clock sources can be synchronized to the
microcontroller system clock or they can run
asynchronously.
When used as a timer with a clock oscillator, an
external, 32.768 kHz crystal can be used in conjunction
with the dedicated internal oscillator circuit.
TABLE 13-1:
TIMER1 CLOCK SOURCE SELECTION
Note:
In Counter mode, a falling edge must be
registered by the counter prior to the first
incrementing rising edge after any one or
more of the following conditions:
• Timer1 is enabled after a POR Reset
• Write to TMR1H or TMR1L
• Timer1 is disabled
• Timer1 is disabled (TMR1ON = 0)
When T1CKI is high, Timer1 is enabled
(TMR1ON = 1) when T1CKI is low.
TMR1CS1
TMR1CS0
SOSCEN
Clock Source
0
1
x
Clock Source (F
OSC
)
0
0
x
Instruction Clock (F
OSC
/4)
1
0
0
External Clock on T1CKI Pin
1
0
1
Oscillator Circuit on SOSCI/SOSCO Pins