TIMER B
8.5 Pulse period/pulse width measurement mode
(2) Timer Bi overflow flag
✕ When counter clear type is selected
A timer Bi interrupt request occurs when a measurement pulse’s valid edge is input or when a
counter overflow occurs. The timer Bi overflow flag is used to identify the source of the interrupt
request occurrence, that is, whether it is an overflow occurrence or a valid edge input.
The timer Bi overflow flag is set to “1” at an overflow occurrence. Accordingly, the source of the
interrupt request occurrence is identified by checking the timer Bi overflow flag in the interrupt
routine. When a value is written to the timer Bi mode register after the next count timing of the
count source with the count start bit = “1,” the timer Bi overflow flag will be cleared to “0”.
The timer Bi overflow flag is a read-only bit.
Use the timer Bi interrupt request bit to detect the overflow timing. Do not use the timer Bi overflow
flag for this detection.
✕ When free-run type is selected
The timer Bi overflow flag is set to “1” at an overflow occurrence. (At this time, no timer Bi interrupt
request is generated.) Accordingly, whether a counter overflow occurs between valid edges is
identified by checking the timer Bi overflow flag in the interrupt routine owing to a valid edge input.
When a value is written to the timer Bi mode register after the next count timing of the count
source with the count start bit = “1,” the timer Bi overflow flag will be cleared to “0”.
The timer Bi overflow flag is a read-only bit.
Figure 8.5.3 shows the processing example of a timer Bi interrupt when a measurement pulse’s valid
edge is detected by the timer Bi interrupt request.
Timer Bi interrupt
(Note 1)
Measured value is read out.
(Note 2)
0
Timer Bi overflow flag ?
1
Timer Bi overflow flag is
cleared to “0.” (Note 3)
Processing without overflow
Processing with overflow
RTI
Notes 1: The valid edge of the measurement pulse is detected.
2: Be sure to read out the timer Bi register.
3: After the timer Bi overflow flag is set to “1”, be sure to wait for one cycle
of the count source to elapse.
Then, write a value to the timer Bi mode register.
Fig. 8.5.3 Processing example of timer Bi interrupt when free-run count type is selected
7906 Group User’s Manual Rev.2.0
8-24