
R01UH0092EJ0110 Rev.1.10
Page 317 of 807
Jul 31, 2012
M16C/64C Group
18. Timer B
18.3.3
Event Counter Mode
In event counter mode, the timer counts pulses from an external device, or overflows and underflows of
other timers. Table 18.7 lists Event Counter Mode Specifications, Table 18.8 lists Registers and
Settings in Event Counter Mode, and Figure 18.5 shows an Operation Example in Event Counter
Mode.
Table 18.7
Event Counter Mode Specifications
Item
Specification
Count sources
•
External signals input to TBiIN pin (active edge can be selected by a
program: rising edge, falling edge, or both rising and falling edges)
•
Timer Bj overflow or underflow
Count operations
•
Decrement
•
When the timer underflows, it reloads the reload register value and
continues counting.
Number of counts
n: setting value of the TBi register 0000h to FFFFh
Count start condition
Set the TBiS bit to 1 (start counting).
Count stop condition
Set the TBiS bit to 0 (stop counting).
Interrupt request
generation timing
Timer underflow
TBiIN pin function
Count source input
Read from timer
Count value can be read by reading the TBi register.
Write to timer
•
When not counting
The value written to the TBi register is written to both the reload register and
the counter.
•
When counting
The value written to the TBi register is written to only reload register
(transferred to counter when reloaded next).
i = 0 to 5
j = i - 1, except j = 2 if i = 0; j = 5 if i = 3
TBiS: Bit in the TABSR or TBSR register
Table 18.8
Registers and Settings in Event Counter Mode
(1)
Register
Bit
Function and Setting
PCLKR
PCLK0
- (setting unnecessary)
CPSRF
CPSR
Write 1 to reset the clock prescaler.
PCLKSTP1
PCKSTP11
- (setting unnecessary)
PCKSTP17
- (setting unnecessary)
TBi1
15 to 0
- (setting unnecessary)
PPWFS1 to
PPWFS2
PPWFS12 to PPWFS10
PPWFS22 to PPWFS20
Set to 0.
TBCS0 to TBCS3
7 to 0
- (setting unnecessary)
TABSR
TBSR
TBiS
Set to 1 when starting counting.
Set to 0 when stopping counting.
TBi
15 to 0
Set the count value.
TBiMR
7 to 0
Refer to the TBiMR register below.
i = 0 to 5
Note:
1.
This table does not describe a procedure.
1
n
1
+
(
)
------------------
Содержание M16C Series
Страница 846: ...M16C 64C Group R01UH0092EJ0110...