9.4.2
Basic Functions
Counter Operation: When one of bits STR0 to STR2 is set to 1 in the timer start register (TSTR),
the timer counter (TCNT) in the corresponding channel starts counting. The counting can be free-
running or periodic.
• Sample setup procedure for counter
Figure 9.12 shows a sample procedure for setting up a counter.
Counter setup
Select counter clock
Type of counting?
Periodic counting
Select counter clear source
Select output compare
register function
Set period
Start counter
Periodic counter
1. Set bits TPSC2 to TPSC0 in TCR to select the counter clock source. If an external clock source
is selected, set bits CKEG1 and CKEG0 in TCR to select the desired edge(s) of the external
clock signal.
1
No
Yes
2
3
4
5
Figure 9.12 Counter Setup Procedure (Example)
Section 9 16-Bit Timer
Free-running counting
Start counter
Free-running counter
Rev. 4.00 Jan 26, 2006 page 363 of 938
5
REJ09B0276-0400