38B5 Group User’s Manual
APPLICATION
2-19
2.2 Timer
2.2.3 Timer application examples
(1)
Basic functions and uses
[Function 1] Control of event interval (Timer 1 to Timer 6, Timer X: timer mode)
When a certain time, by setting a count value to each timer, has passed, the timer interrupt request occurs.
<Use>
Generating of an output signal timing
Generating of a wait time
[Function 2] Control of cyclic operation (Timer 1 to Timer 6, Timer X: timer mode)
The value of the timer latch is automatically written to the corresponding timer each time the timer
underflows, and each timer interrupt request occurs in cycles.
<Use>
Generating of cyclic interrupts
Clock function (measurement of 1 s); see “(2) Timer application example 1”
Control of a main routine cycle
[Function 3] Output of rectangular waveform
(Timer 1, Timer 3, Timer 6, Timer X: pulse output mode)
The output level of the T1OUT pin, T3OUT pin, PWM1 pin or CNTR2 pin is inverted each time the timer
underflows.
<Use>
Piezoelectric buzzer output; see “(3) Timer application example 2”
Generating of the remote control carrier waveforms
[Function 4] Count of external pulses (Timer 2, Timer 4, Timer X: event counter mode)
External pulses input to the CNTR0 pin, CNTR1 pin, CNTR2 pin are counted as the timer count
source (in the event counter mode).
<Use>
Frequency measurement; see “(4) Timer application example 3”
Division of external pulses
Generating of interrupts due to a cycle using external pulses as the count source; count of a reel pulse
[Function 5] Output of PWM signal (Timer 6)
“H” interval and “L” interval are specified, respectively, and the output of pulses from P44/PWM1
pin is repeated.
<Use>
Control of electric volume
[Function 6] Measurement of external pulse width (Timer X: pulse width measurement mode)
The “H” or “L” level width of external pulses input to CNTR2 pin is measured.
<Use>
Measurement of external pulse frequency (measurement of pulse width of FG pulse
V for a motor);
see “(5) Timer application example 4”
Measurement of external pulse duty (when the frequency is fixed)
FG pulseV: Pulse used for detecting the motor speed to control the motor speed.
[Function 7] Control of real time port (Timer X: real time port function)
The data for real time is output from the P85 pin or P86 pin each time the timer underflows.
<Use>
Stepping motor control; see “(6) Timer application example 5”