Rev. 2.00, 09/03, page 318 of 690
12.4
Operation
Each of the three channels has a 32-bit timer counter (TCNT) and a 32-bit timer constant register
(TCOR). The TCNT counts down. The auto-reload function enables synchronized counting and
counting by external events. Channel 2 has an input capture function.
12.4.1
Counter Operation
When the STR0 to STR2 bits in the timer start register (TSTR) are set to 1, the corresponding
timer counter (TCNT) starts counting. When a TCNT underflows, the UNF flag of the
corresponding timer control register (TCR) is set. At this time, if the UNIE bit in TCR is 1, an
interrupt request is sent to the CPU. Also at this time, the value is copied from TCOR to TCNT
and the down-count operation is continued.
Count Operation Setting Procedure: An example of the procedure for setting the count
operation is shown in figure 12.2.
Select operation
Select counter
clock
Set underflow
interrupt generation
Set timer constant
register
Initialize timer
counter
Start counting
(1)
(2)
(4)
(5)
(6)
Set input capture
interrupt generation
When using input
capture function
(3)
Note: When an interrupt has been generated, clear the flag in the interrupt handler that caused it.
If interrupts are enabled without clearing the flag, another interrupt will be generated.
Select the counter clock with the TPSC0-TPSC2
bits in the timer control register. If the external
clock is selected, select its edge with the CKEG1
and CKEG0 bits in the timer control register.
Use the UNIE bit in the timer control register to set
whether to generate an interrupt when timer
counter underflows.
When using the input capture function, set the
ICPE bits in the timer control register, including
the choice of whether or not to use the interrupt
function (channel 2 only).
Set a value in the timer constant register
(the cycle is the set value plus 1).
Set the initial value in the timer counter.
Set the STR bit in the timer start register to 1 to
start operation.
(1)
(2)
(3)
(4)
(5)
(6)
Figure 12.2 Setting Count Operation
Содержание SH7705
Страница 2: ......
Страница 46: ...Rev 2 00 09 03 page xlvi of xlvi Appendix Table A 1 I O Port States in Each Processing State 679 ...
Страница 70: ...Rev 2 00 09 03 page 24 of 690 ...
Страница 194: ...Rev 2 00 09 03 page 148 of 690 ...
Страница 284: ...Rev 2 00 09 03 page 238 of 690 ...
Страница 338: ...Rev 2 00 09 03 page 292 of 690 ...
Страница 354: ...Rev 2 00 09 03 page 308 of 690 ...
Страница 374: ...Rev 2 00 09 03 page 328 of 690 ...
Страница 420: ...Rev 2 00 09 03 page 374 of 690 ...
Страница 476: ...Rev 2 00 09 03 page 430 of 690 ...
Страница 482: ...Rev 2 00 09 03 page 436 of 690 ...
Страница 552: ...Rev 2 00 09 03 page 506 of 690 ...
Страница 630: ...Rev 2 00 09 03 page 584 of 690 ...
Страница 739: ...SH7705 Group Hardware Manual REJ09B0082 0200O ...