
7542 Group
Rev.3.02 Oct 31, 2006 Page 31 of 134
REJ03B0006-0302
(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;
■
Note on Timer X
(1) CNTR
0
interrupt active edge selection-1
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.
(2) CNTR
0
interrupt active edge selection-2
According to the setting value of CNTR
0
active edge switch bit,
the interrupt request bit may be set to “1”.
When not requiring the interrupt occurrence synchronized with
these setting, take the following sequence.
➀
Set the corresponding interrupt enable bit to “0” (disabled).
➁
Set the active edge switch bit.
➂
Set the corresponding interrupt request bit to “0” after 1 or more
instructions have been executed.
➃
Set the corresponding interrupt enable bit to “1” (enabled).
Fig. 26 Structure of timer X mode register
Fig. 27 Timer count source set register
T
i
m
e
r
X
m
o
d
e
r
e
g
i
s
t
e
r
(
T
X
M
:
a
d
d
r
e
s
s
0
0
2
B
1
6
,
i
n
i
t
i
a
l
v
a
l
u
e
:
0
0
1
6
)
C
N
T
R
0
a
c
t
i
v
e
e
d
g
e
s
w
i
t
c
h
b
i
t
0
:
I
n
t
e
r
r
u
p
t
a
t
f
a
l
l
i
n
g
e
d
g
e
C
o
u
n
t
a
t
r
i
s
i
n
g
e
d
g
e
(
i
n
e
v
e
n
t
c
o
u
n
t
e
r
m
o
d
e
)
1
:
I
n
t
e
r
r
u
p
t
a
t
r
i
s
i
n
g
e
d
g
e
C
o
u
n
t
a
t
f
a
l
l
i
n
g
e
d
g
e
(
i
n
e
v
e
n
t
c
o
u
n
t
e
r
m
o
d
e
)
T
i
m
e
r
X
o
p
e
r
a
t
i
n
g
m
o
d
e
b
i
t
s
b
1
b
0
0
0
:
T
i
m
e
r
m
o
d
e
0
1
:
P
u
l
s
e
o
u
t
p
u
t
m
o
d
e
1
0
:
E
v
e
n
t
c
o
u
n
t
e
r
m
o
d
e
1
1
:
P
u
l
s
e
w
i
d
t
h
m
e
a
s
u
r
e
m
e
n
t
m
o
d
e
N
o
t
u
s
e
d
(
r
e
t
u
r
n
“
0
”
w
h
e
n
r
e
a
d
)
T
i
m
e
r
X
c
o
u
n
t
s
t
o
p
b
i
t
0
:
C
o
u
n
t
s
t
a
r
t
1
:
C
o
u
n
t
s
t
o
p
b7 b0
P
0
3
/
T
X
O
U
T
o
u
t
p
u
t
v
a
l
i
d
b
i
t
0
:
O
u
t
p
u
t
i
n
v
a
l
i
d
(
I
/
O
p
o
r
t
)
1
:
O
u
t
p
u
t
v
a
l
i
d
(
I
n
v
e
r
t
e
d
C
N
T
R
0
o
u
t
p
u
t
)
b7 b0
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
Notes 1: f(X
IN
) can be used as timer X count source when using
a ceramic resonator or on-chip oscillator.
Do not use it at RC oscillation.
2: On-chip oscillator can be used when the on-chip oscillator
is enabled by bit 3 of CPUM.
Timer count source set register
(TCSS : address 002A
16
, initial value: 00
16
)
Timer B count source selection bits
b7 b6 b5
0 0 0 : f(X
IN
)/16
0 0 1 : f(X
IN
)/2
0 1 0 : f(X
IN
)/32
0 1 1 : f(X
IN
)/64
1 0 0 : f(X
IN
)/128
1 0 1 : f(X
IN
)/256
1 1 0 : Timer A underflow
1 1 1 : Not available
Timer A count source selection bits
b4 b3 b2
0 0 0 : f(X
IN
)/16
0 0 1 : f(X
IN
)/2
0 1 0 : f(X
IN
)/32
0 1 1 : f(X
IN
)/64
1 0 0 : f(X
IN
)/128
1 0 1 : f(X
IN
)/256
1 1 0 : On-chip oscillator output (Note 2)
1 1 1 : Not available