
XC161 Derivatives
Peripheral Units (Vol. 2 of 2)
The General Purpose Timer Units
User’s Manual
14-27
V2.2, 2004-01
GPT_X1, V2.0
14.1.5
GPT1 Clock Signal Control
All actions within the timer block GPT1 are triggered by transitions of its basic clock. This
basic clock is derived from the system clock by a basic block prescaler, controlled by
bitfield BPS1 in register T3CON (see
). The count clock can be generated in
two different ways:
•
Internal count clock, derived from GPT1’s basic clock via a programmable
prescaler, is used for (gated) timer mode.
•
External count clock, derived from the timer’s input pin(s), is used for counter mode.
For both ways, the basic clock determines the maximum count frequency and the timer’s
resolution:
Internal Count Clock Generation
In timer mode and gated timer mode, the count clock for each GPT1 timer is derived from
the GPT1 basic clock by a programmable prescaler, controlled by bitfield TxI in the
respective timer’s control register TxCON.
The count frequency
f
Tx
for a timer Tx and its resolution
r
Tx
are scaled linearly with lower
clock frequencies, as can be seen from the following formula:
(14.1)
The effective count frequency depends on the common module clock prescaler factor
F(BPS1) as well as on the individual input prescaler factor 2
<TxI>
summarizes
the resulting overall divider factors for a GPT1 timer that result from these cascaded
prescalers.
lists a timer’s parameters (such as count frequency, resolution, and period)
resulting from the selected overall prescaler factor and the applied system frequency.
Note that some numbers may be rounded.
Table 14-6
Basic Clock Selection for Block GPT1
Block Prescaler
1)
1) Please note the non-linear encoding of bitfield BPS1.
BPS1 = 01
B
BPS1 = 00
B
2)
2) Default after reset.
BPS1 = 11
B
BPS1 = 10
B
Prescaling Factor for
GPT1: F(BPS1)
F(BPS1)
= 4
F(BPS1)
= 8
F(BPS1)
= 16
F(BPS1)
= 32
Maximum External
Count Frequency
f
GPT
/8
f
GPT
/16
f
GPT
/32
f
GPT
/64
Input Signal
Stable Time
4
×
t
GPT
8
×
t
GPT
16
×
t
GPT
32
×
t
GPT
f
Tx
f
GPT
F BPS1
(
)
2
<Txl>
×
---------------------------------------------
=
r
Tx
µ
s
[ ]
F BPS1
(
)
2
<Txl>
×
f
GPT
MHz
[
]
---------------------------------------------
=