Technical information
APPLICATION
2.2 Timer
2-17
3800 GROUP USER’S MANUAL
(4) Timer application example 3 : Measurement of frequency
Outline : The following two values are compared for judging if the frequency is within a certain range.
• A value counted a pulse which is input to P5
5/CNTR1 pin by a timer.
• A referance value
Specifications : • The pulse is input to the P5
5/CNTR1 pin and counted by the Timer Y.
• A count value is read out at the interval of about 2 ms (Timer 1 interrupt interval
: 244 µs ✕ 8). When the count value is 28 to 40, it is regarded the input pulse
as a valid.
• Because the timer is a down-counter, the count value is compared with 227 to 215
✽
.
✽ 227 to 215 = 255 (initialized value of counter) – 28 to 40 (the number of valid
value).
Figure 2.2.17 shows a method for judging if input pulse exists, and Figure 2.2.18 shows a setting of
related registers.
Input pulse
71.4 µs or more
(14 kHz or less)
71.4 µs
(14 kHz)
50 µs(20 kHz) 50 µs or less
(20 kHz or more)
Invalid Valid Invalid
2 ms
71.4 µs
= 28 counts
2 ms
50 µs
= 40 counts
• • • • • • • • • • • •
Fig 2.2.17 A method for judging if input pulse exists