![](http://datasheet.mmic.net.cn/110000/M30201F6-SP_datasheet_3496102/M30201F6-SP_232.png)
Mitsubishi microcomputers
M30201 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Timer X
220
2.4.1 Overview
The following is an overview for timer X, a 16-bit timer.
(1) Mode
Timer X operates in one of the four modes:
(a) Timer mode
In this mode, the internal count source is counted. Two functions can be selected: the pulse output
function that reverses output from a port every time an overflow occurs, or the gate function which
controls the count start/stop according to the input signal from a port.
Timer mode operation .............................................................................................................. P224
Timer mode, gate function operation ........................................................................................ P226
Timer mode, pulse output function operation ........................................................................... P228
(b) Event counter mode
This mode counts the pulses from the outside and the number of overflows in other timers. The free-
run type, in which nothing is reloaded from the reload register, can be selected when an underflow
occurs. The pulse output function can also be selected.
Event counter mode operation ................................................................................................. P230
Event counter mode, free run type operation ........................................................................... P232
(c) One-shot timer mode
In this mode, the timer is started by the trigger and stops when the timer goes to “0”. The trigger can be
selected from the following 3 types: an external input signal, an overflow of the timer, or a software trigger.
One-shot timer mode operation ................................................................................................ P234
(d) Pulse period measurement/pulse width measurement mode
External pulse period or external pulse widths are measured. If pulse period measurement mode is
selected, the periods of input pulses are continuously measured. If pulse width measurement mode
is selected, widths of “H” level pulses and those of “L” level pulses are continuously measured.
Operation in pulse period measurement mode ........................................................................ P236
Operation in pulse width measurement mode .......................................................................... P238
(d) Pulse width modulation (PWM) mode
In this mode, the arbitrary pulses are successively output. Either a 16-bit fixed-period PWM mode or
8-bit variable-period mode can be selected. The trigger for initiating output can also be selected.
16-bit PWM mode operation ..................................................................................................... P240
8-bit PWM mode operation ....................................................................................................... P242
(2) Count source
The internal count source can be selected from f1, f8, f32, and fC32. Clocks f1, f8, and f32 are derived
by dividing the CPU's main clock by 1, 8, and 32 respectively. Clock fC32 is derived by dividing the
CPU's secondary clock by 32.
2.4 Timer X