R01UH0092EJ0110 Rev.1.10
Page 274 of 807
Jul 31, 2012
M16C/64C Group
17. Timer A
17.3.3
Event Counter Mode (When Not Using Two-Phase Pulse Signal Processing)
In event counter mode, the timer counts pulses from an external device, or overflows/underflows of
other timers. Timers A2, A3, and A4 can count two-phase external signals. Refer to 17.3.4 “Event
Counter Mode (When Processing Two-Phase Pulse Signal)” for details. Table 17.8 lists Event Counter
Mode Specifications (When Not Using Two-Phase Pulse Signal Processing). Table 17.9 lists Registers
and the Setting in Event Counter Mode (When Not Processing Two-Phase Pulse Signal). Figure 17.6
shows Operation Example in Event Counter Mode.
Table 17.8
Event Counter Mode Specifications (When Not Using Two-Phase Pulse Signal Processing)
Item
Specification
Count source
•
External signals input to the TAiIN pin (active edge can be selected)
•
Timer B2 overflows or underflows
•
Timer Aj overflows or underflows (j = i - 1, except j = 4 if i = 0)
•
Timer Ak overflows or underflows (k = i + 1, except k = 0 if i = 4)
Count operations
•
Increment or decrement can be selected by a program.
•
When the timer overflows or underflows, it reloads the reload register value and
continues counting. When selecting free-run type, the timer continues counting
without reloading.
Number of counts
When selecting reload type:
•
FFFFh - n + 1 for increment
•
n + 1 for decrement
n: setting value of the TAi register, 0000h to FFFFh
Count start condition
Set the TAiS bit in the TABSR register to 1 (start counting).
Count stop condition
Set the TAiS bit to 0 (stop counting).
Interrupt request
generation timing
Timer overflow or underflow
TAiIN pin function
I/O port or count source input
TAiOUT pin function
I/O port or pulse output
Read from timer
Count value can be read by reading the TAi register.
Write to timer
•
When not counting
Value written to the TAi register is written to both the reload register and
counter.
•
When counting
Value written to the TAi register is written to only reload register
(transferred to counter when reloaded next).
Selectable functions
•
Free-run count function
Even when the timer overflows or underflows, the reload register content is not
reloaded.
•
Pulse output function
Whenever the timer underflows or underflows, the output polarity of the
TAiOUT pin is inverted. When the TAiS bit is set to 0 (stop counting), the pin
outputs a low-level signal.
•
Output polarity control
The output polarity of the TAiOUT pin is inverted. (While the TAiS bit is set to 0
(stop counting), a high-level signal is output.)
i = 0 to 4
Содержание M16C Series
Страница 846: ...M16C 64C Group R01UH0092EJ0110...