
38
3803/3804 Group
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
MITSUBISHI MICROCOMPUTERS
(3) Event counter mode
G
Mode selection
This mode can be selected by setting
“
10
”
to the timer X operating
mode bits (bits 1 and 0) and the timer Y operating mode bits (bits
5 and 4) of the timer XY mode register (address 0023
16
).
G
Explanation of operation
The operation is the same as the timer mode
’
s except that the
timer counts signals input from the CNTR
0
or CNTR
1
pin. The
valid edge for the count operation depends on the CNTR
0
active
edge switch bit (bit 2) or the CNTR
1
active edge switch bit (bit 6)
of the timer XY mode register (address 0023
16
). When it is
“
0
”
, the
rising edge is valid. When it is
“
1
”
, the falling edge is valid.
I
Precautions
Set the double-function port of CNTR
0
/CNTR
1
pin and port P5
4
/
P5
5
to input in this mode.
(4) Pulse width measurement mode
G
Mode selection
This mode can be selected by setting
“
11
”
to the timer X operating
mode bits (bits 1 and 0) and the timer Y operating mode bits (bits
5 and 4) of the timer XY mode register (address 0023
16
).
G
Explanation of operation
When the CNTR
0
active edge switch bit (bit 2) or the CNTR
1
ac-
tive edge switch bit (bit 6) of the timer XY mode register (address
0023
16
) is
“
1
”
, the timer counts during the term of one falling edge
of CNTR
0
/CNTR
1
pin input until the next rising edge of input (
“
L
”
term). When it is
“
0
”
, the timer counts during the term of one rising
edge input until the next falling edge input (
“
H
”
term).
I
Precautions
Set the double-function port of CNTR
0
/CNTR
1
pin and port P5
4
/
P5
5
to input in this mode.
The count operation can be stopped by setting
“
1
”
to the timer X
count stop bit (bit 3) and the timer Y count stop bit (bit 7) of the
timer XY mode register (address 0023
16
). The interrupt request bit
is set to
“
1
”
each time the timer underflows.
Precautions when switching count source
When switching the count source by the timer 12, X and Y count
source selection bits, the value of timer count is altered in incon-
siderable amount owing to generating of thin pulses on the count
input signals.
Therefore, select the timer count source before setting the value
to the prescaler and the timer.