English
Language : 

PIC18F1XK22 Datasheet, PDF (104/388 Pages) Microchip Technology – 20-Pin Flash Microcontrollers with nanoWatt XLP Technology
PIC18F1XK22/LF1XK22
10.2 Timer1 16-Bit Read/Write Mode
Timer1 can be configured for 16-bit reads and writes
(see Figure 10-2). When the RD16 control bit of the
T1CON register is set, the address for TMR1H is
mapped to a buffer register for the high byte of Timer1.
A read from TMR1L will load the contents of the high
byte of Timer1 into the Timer1 high byte buffer. This
provides the user with the ability to accurately read all
16 bits of Timer1 without the need to determine
whether a read of the high byte, followed by a read of
the low byte, has become invalid due to a rollover or
carry between reads.
Writing to TMR1H does not directly affect Timer1.
Instead, the high byte of Timer1 is updated with the
contents of TMR1H when a write occurs to TMR1L.
This allows all 16 bits of Timer1 to be updated at once.
The high byte of Timer1 is not directly readable or
writable in this mode. All reads and writes must take
place through the Timer1 High Byte Buffer register.
Writes to TMR1H do not clear the Timer1 prescaler.
The prescaler is only cleared on writes to TMR1L.
10.3 Clock Source Selection
The TMR1CS bit of the T1CON register is used to select
the clock source. When TMR1CS = 0, the clock source
is FOSC/4. When TMR1CS = 1, the clock source is
supplied externally.
Clock
Source
FOSC/4
T1CKI pin
T1LPOSC
T1OSCEN
FOSC
Mode
x
xxx
0
xxx
1
LP or
INTOSCIO
TMR1CS
0
1
1
10.3.1 INTERNAL CLOCK SOURCE
When the internal clock source is selected the
TMR1H:TMR1L register pair will increment on multiples
of FOSC as determined by the Timer1 prescaler.
10.3.2 EXTERNAL CLOCK SOURCE
When the external clock source is selected, the Timer1
module may work as a timer or a counter.
When counting, Timer1 is incremented on the rising
edge of the external clock input T1CKI. In addition, the
Counter mode clock can be synchronized to the
microcontroller system clock or run asynchronously.
If an external clock oscillator is needed (and the
microcontroller is using the INTOSC without CLKOUT),
Timer1 can use the LP oscillator as a clock source.
Note:
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 enabled after POR
• Write to TMR1H or TMR1L
• Timer1 is disabled
• Timer1 is disabled (TMR1ON 0) when
T1CKI is high then Timer1 is enabled
(TMR1ON=1) when T1CKI is low.
See Figure 9-2.
10.4 Timer1 Oscillator
An on-chip crystal oscillator circuit is incorporated
between pins OSC1 (input) and OSC2 (amplifier output).
It is enabled by setting the Timer1 Oscillator Enable bit,
T1OSCEN of the T1CON register. The oscillator is a
low-power circuit rated for 32 kHz crystals. It will
continue to run during all power-managed modes. The
circuit for a typical LP oscillator is shown in Figure 10-3.
Table 10-1 shows the capacitor selection for the Timer1
oscillator.
The Timer1 oscillator is shared with the system LP
oscillator. Thus, Timer1 can use this mode only when
the primary system clock is derived from the internal
oscillator or when the oscillator is in the LP mode. The
user must provide a software time delay to ensure
proper oscillator start-up.
FIGURE 10-3:
C1
27 pF
EXTERNAL
COMPONENTS FOR THE
TIMER1 LP OSCILLATOR
PIC® MCU
OSC1
XTAL
32.768 kHz
C2
27 pF
OSC2
Note:
See the Notes with Table 10-1 for additional
information about capacitor selection.
DS41365D-page 104
Preliminary
 2010 Microchip Technology Inc.