English
Language : 

SH7020 Datasheet, PDF (262/509 Pages) Renesas Technology Corp – SuperH™ RISC engine
• Procedure for selecting counting mode (figure 10.14):
1. Set bits TPSC2–TPSC0 in the TCR to select the counter clock source. If an external clock
source is selected, set bits CKEG1 and CKEG0 in the TCR to select the desired edges of
the external clock signal.
2. To operate as a periodic counter, set CCLR1 and CCLR0 in the TCR to select whether to
clear the TCNT at GRA compare match or GRB compare match.
3. Set the GRA or GRB selected in step 2 as an output compare register using the timer I/O
control register (TIOR).
4. Write the desired cycle value in the GRA or GRB selected in step 1.
5. Set the STR bit in the TSTR to 1 to start counting.
Counting mode selection
Select counter clock
(1)
Counting?
No
Yes
Periodic counter
Select counter
clear source
(2)
Select output
compare register
(3)
Set period
(4)
Free-running counter
Start counting
(5)
Start counting
(5)
Periodic counter
Free-running counter
Figure 10.14 Procedure for Selecting the Counting Mode
246 RENESAS