
XC161 Derivatives
Peripheral Units (Vol. 2 of 2)
Capture/Compare Units
User’s Manual
17-6
V2.2, 2004-01
CC12_X1, V2.1
Timer Mode
In Timer Mode (TxM = 0), the input clock for a CAPCOM timer is derived from
f
CC
,
divided by a programmable prescaler. Each timer has its own individual prescaler,
controlled through the individual bitfields TxI in the timer control registers T01CON and
T78CON.
The input frequency
f
Tx
for a timer Tx and its resolution
r
Tx
are determined by the
following formulas:
Staggered Mode:
(17.1)
Non-Staggered Mode:
(17.2)
When a timer overflows from FFFF
H
to 0000
H
, it is reloaded with the value stored in its
respective reload register TxREL. The reload value determines the period P
Tx
between
two consecutive overflows of Tx as follows:
Staggered Mode:
(17.3)
Non-Staggered Mode:
(17.4)
After a timer has been started by setting its run flag (TxR), the first increment will occur
within the time interval which is defined by the selected timer resolution. All further
increments occur exactly after the time defined by the timer resolution.
Examples for timer input frequencies, resolution and periods, which result from the
selected prescaler option in TxI when using a 40 MHz clock, are listed in
below. The numbers for the timer periods are based on a reload value of 0000
H
. Note
that some numbers may be rounded.
f
Tx
MHz
[
]
f
CC
MHz
[
]
2
<Txl>
3
+
(
)
--------------------------
=
r
Tx
µ
s
[ ]
2
<Txl>
3
+
(
)
f
CC
MHz
[
]
--------------------------
=
f
Tx
MHz
[
]
f
CC
MHz
[
]
2
<Txl>
--------------------------
=
r
Tx
µ
s
[ ]
2
<Txl>
f
CC
MHz
[
]
--------------------------
=
P
Tx
µ
s
[ ]
2
16
<TxREL>
–
(
)
2
×
<Txl>
3
+
(
)
f
CC
MHz
[
]
-------------------------------------------------------------------------
=
P
Tx
µ
s
[ ]
2
16
<TxREL>
–
(
)
2
×
<Txl>
f
CC
MHz
[
]
----------------------------------------------------------------
=