
2-20
3802 GROUP USER’S MANUAL
APPLICATION
2.2 Timer
(5) Timer application example 4 : Measurement of pulse width of FG pulse generated by motor
Outline :
The “H” level width of a pulse input to the P5
4
/CNTR
0
pin is counted by Timer X. An
underflow is detected by Timer X interrupt and an end of the input pulse “H” level is
detected by CNTR
0
interrupt.
Specifications :
The “H” level width of a FG pulse input to the P5
4
/CNTR
0
pin is counted by Timer
X. (Example : When the clock frequency is 4.19 MHz, the count source would be
3.8 μ s that is obtained by dividing the clock frequency by 16.
Measurement can be made up to 250 ms in the range of FFFF
16
to 0000
16
.)
Figure 2.2.20 shows a connection of the timer and a setting of the division ration, and Figure 2.2.21
shows a setting of related registers.
Fig. 2.2.20 Connection of the timer and setting of the division ratio [Measurement of pulse width]
Timer X interrupt request bit
1/16
0 or 1
1/256
1/256
Fixed
Prescaler X
Timer X
250 ms
0 : No interrupt request
1 : Interrupt request
f(X
IN
) = 4.19 MHz