7540 Group User
’
s Manual
2-58
APPLICATION
2.4 Timer X
2.4.6 Pulse width measurement mode
(1) Operation description
In the pulse width measurement mode, the pulse width of the signal input to P1
4
/CNTR
0
pin is
measured.
The operation of Timer X can be controlled by the level of the signal input from the CNTR
0
pin.
When the CNTR
0
active edge switch bit is
“
0
”
, the signal selected by the timer X count source
selection bit is counted while the input signal level of CNTR
0
pin is
“
H
”
. The count is stopped while
the pin is
“
L
”
. Also,
when the CNTR
0
active edge switch bit is
“
1
”
, the signal selected by the timer X count source
selection bit is counted while the input signal level of CNTR
0
pin is
“
L
”
. The count is stopped while
the pin is
“
H
”
.
Timer X can stop counting by setting
“
1
”
to the timer X count stop bit.
Also, when Timer X underflows, the timer X interrupt request bit is set to
“
1
”
.
(2) Pulse width HL continuously measurement mode setting method
Figure 2.4.23 and Figure 2.4.24 show the setting method for pulse width measurement mode of timer
X.
Fig. 2.4.23 Setting method for pulse width measurement mode (1)
b
7
b0
b
7
b0
1
1
1
b
7
b0
0
0
b
0
7
b
0
0
P
r
o
c
e
s
s
1
:
D
i
s
a
b
l
e
t
i
m
e
r
X
i
n
t
e
r
r
u
p
t
a
n
d
C
N
T
R
0
i
n
t
e
r
r
u
p
t
.
In
N
T
t
e
r
r
u
p
t
c
o
n
t
r
o
l
r
e
g
i
s
t
e
r
1
(
I
C
O
N
1
)
[
A
d
d
r
e
s
s
3
E
1
6
]
C
T
e
R
0
r
i
n
i
t
e
t
r
r
r
u
r
p
u
t
t
d
i
s
i
a
s
b
a
l
e
l
d
e
i
m
X
n
e
p
d
b
d
Port P1 direction register (P1D) [Address 03
16
]
Set the P1
4
/CNTR
0
pin to the input mode
Process 2: Set the CNTR
0
pin to the input mode.
P
r
o
c
e
s
s
3
:
S
e
t
t
i
m
e
r
X
m
o
d
e
r
e
g
i
s
t
e
r
.
Timer X mode register (TXM) [Address 2B
16
]
P
C
0
1
T
u
l
s
T
“
H
“
L
e
e
R
0
”
”
r
w
i
a
e
e
X
d
t
h
t
i
e
e
c
o
v
l
l
u
m
e
w
w
n
e
e
i
d
i
d
t
a
d
t
t
h
s
t
s
g
h
o
u
e
m
m
p
r
e
s
e
e
m
w
a
a
e
i
t
s
s
n
c
u
u
t
m
o
d
e
N
:
:
i
m
c
v
v
h
r
r
e
l
l
e
m
m
e
e
n
n
t
t
N
o
t
e
:
f
D
(
X
I
o
N
)
n
c
t
a
u
n
s
e
b
e
f
(
X
I
u
s
N
)
e
d
a
o
t
n
R
l
C
y
w
o
h
s
e
c
n
l
l
a
a
t
i
c
o
e
n
r
.
a
m
i
c
r
e
s
o
n
a
t
o
r
o
r
a
r
i
n
g
o
s
c
i
l
l
a
t
o
r
i
s
u
s
e
d
.
o
i
Process 4: Set timer X count source.
T
i
i
b
m
e
r
c
o
u
n
t
s
o
u
r
c
e
s
e
t
r
e
g
i
s
t
e
r
(
T
C
S
S
)
[
A
d
d
r
e
s
s
2
E
1
6
]
T
m
1
0
0
1
1
e
0
0
1
0
1
r
X
c
o
u
n
t
s
o
u
r
c
e
s
e
l
e
c
t
i
o
n
b
i
t
s
b
:
:
:
:
f
f
f
N
(
(
(
X
I
X
I
X
I
o
N
)
N
)
N
)
t
/
/
v
1
2
(
N
a
6
o
i
l
t
e
)
b
a
a
l
e