![Cmsemicon BAT32G1 9 Series Скачать руководство пользователя страница 249](http://html1.mh-extra.com/html/cmsemicon/bat32g1-9-series/bat32g1-9-series_user-manual_2627609249.webp)
BAT32G1x9 user manual | Chapter 7 Timer A
249 / 1149
Rev.1.02
7.4.5
Pulse width measurement mode
This is the mode for measuring the width of the external signal pulse at the input of the TAIO pin.
In pulse width measurement mode, if the level specified by the TEDGSEL bit of the TAIOC0 register is input to
the TAIO pin, the count is decremented by the selected counting source. If the specified level of the TAIO pin input
ends, the counter stops counting, the TEDGF bit of the TACR0 register becomes "1" (with a valid edge) and an
interrupt request is generated. Pulse width data is measured by reading the count value when the counter stops
counting. If the counter underflows during the measurement, the TUNDF bit of the TACR0 register becomes "1"
(underflow occurs) and an interrupt request is generated.
An example of the pulse width measurement mode in operation is shown in Figure 7-14.
To access the TEDGF bits and TUNDF bits of the TARCR0 register, refer to the "7.5.2 Flag Access" (TEDGF of
the TACR0 register bits and TUNDF bits)".
Fig. 7-14 Example of operation of pulse measurement mode
measure pulse
TAIO pin input
INTTMA interrupt
flag bit
TUNDF bit of
TACR0 register
TSTART bit of
TACR0 register
TEDGF bit of
TACR0 register
n=TA0 register content
This is the case where the measurement is performed on the "H" level of the
measurement pulse (TEDGSEL=1 in the TAIOC0 register).
c
o
n
te
n
t
o
f
th
e
c
o
u
n
te
r
(1
6
b
it
s
)
set "0" via program
set "0" via program
set "0" via program
set "1" via program
start measuring
stop measuring
underflow occurs
stop measuring
start measuring
start measuring
Time
0000H
FFFFH
n
accept interrupt request