![](http://datasheet.mmic.net.cn/230000/7540_datasheet_15567442/7540_44.png)
HARDWARE
1-26
7540 Group User
’
s Manual
(4) Pulse width measurement mode
In the pulse width measurement mode, the pulse width of the sig-
nal input to P1
4
/CNTR
0
pin is measured.
The operation of Timer X can be controlled by the level of the sig-
nal 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 in any mode.
Also, when Timer X underflows, the timer X interrupt request bit is
set to
“
1
”
.
Note on Timer X is described below;
I
Note on Timer X
CNTR
0
interrupt active edge selection
CNTR
0
interrupt active edge depends on the CNTR
0
active edge
switch bit.
When this bit is
“
0
”
, the CNTR
0
interrupt request bit is set to
“
1
”
at
the falling edge of CNTR
0
pin input signal. When this bit is
“
1
”
, the
CNTR
0
interrupt request bit is set to
“
1
”
at the rising edge of
CNTR
0
pin input signal.
Fig. 23 Structure of timer X mode register
Fig. 24 Timer count source set register
Timer X mode register
(TXM : address 002B
16
, initial value: 00
16
)
Timer X operating mode bits
b1 b0
0 0 : Timer mode
0 1 : Pulse output mode
1 0 : Event counter mode
1 1 : Pulse width measurement mode
CNTR
0
active edge switch bit
0 : Interrupt at falling edge
Count at rising edge
(in event counter mode)
1 : Interrupt at rising edge
Count at falling edge
(in event counter mode)
Timer X count stop bit
0 : Count start
1 : Count stop
Not used (return
“
0
”
when read)
b7 b0
P0
3
/TX
OUT
output valid bit
0 : Output invalid (I/O port)
1 : Output valid (Inverted CNTR
0
output)
Timer count source set register
(TCSS : address 002E
16
, initial value: 00
16
)
Timer X count source selection bits
b1 b0
0 0 : f(X
IN
)/16
0 1 : f(X
IN
)/2
1 0 : f(X
IN
) (Note 1)
1 1 : Not available
b7 b0
Timer Y count source selection bits
b3 b2
0 0 : f(X
IN
)/16
0 1 : f(X
IN
)/2
1 0 : Ring oscillator output (Note 2)
1 1 : Not available
Timer Z count source selection bits
b5 b4
0 0 : f(X
IN
)/16
0 1 : f(X
IN
)/2
1 0 : Timer Y underflow
1 1 : Not available
Fix this bit to
“
0
”
.
Not used (return
“
0
”
when read)
Notes 1:
f(X
IN
) can be used as timer X count source when using
a ceramic resonator or ring oscillator.
Do not use it at RC oscillation.
2:
System operates using a ring oscillator as a count source
by setting the ring oscillator to oscillation enabled by bit 3
of CPUM.
FUNCTIONAL DESCRIPTION