
Rev.1.00
REJ03B0212-0100
Apr 2, 2007
Page 97 of 117
3803 Group (Spec.L)
Notes on 8-bit Timer (timer 1, 2, X, Y)
If a value n (between 0 and 255) is written to a timer latch, the
frequency division ratio is 1/(n+1).
When switching the count source by the timer 12, X and Y
count source selection bits, the value of timer count is altered
in unconsiderable amount owing to generating of thin pulses in
the count input signals.
Therefore, select the timer count source before set the value to
the prescaler and the timer.
Set the double-function port of the CNTR
0
/CNTR
1
pin and
port P5
4
/P5
5
to output in the pulse output mode.
Set the double-function port of CNTR
0
/CNTR
1
pin and port
P5
4
/P5
5
to input in the event counter mode and the pulse width
measurement mode.
Notes on 16-bit Timer (timer Z)
1. Pulse output mode
Set the double-function port of the CNTR
2
pin and port P4
7
to
output.
2. Pulse period measurement mode
Set the double-function port of the CNTR
2
pin and port P4
7
to
input.
A read-out of timer value is impossible in this mode. The timer
can be written to only during timer stop (no measurement of
pulse period).
Since the timer latch in this mode is specialized for the read-
out of measured values, do not perform any write operation
during measurement.
“FFFF
16
” is set to the timer when the timer underflows or
when the valid edge of measurement start/completion is
detected.
Consequently, the timer value at start of pulse period
measurement depends on the timer value just before
measurement start.
3. Pulse width measurement mode
Set the double-function port of the CNTR
2
pin and port P4
7
to
input.
A read-out of timer value is impossible in this mode. The timer
can be written to only during timer stop (no measurement of
pulse period).
Since the timer latch in this mode is specialized for the read-
out of measured values, do not perform any write operation
during measurement.
“FFFF
16
” is set to the timer when the timer underflows or
when the valid edge of measurement start/completion is
detected.
Consequently, the timer value at start of pulse width
measurement depends on the timer value just before
measurement start.
4. Programmable waveform generating mode
Set the double-function port of the CNTR
2
pin and port P4
7
to
output.
5. Programmable one-shot generating mode
Set the double-function port of CNTR
2
pin and port P4
7
to
output, and of INT
1
pin and port P4
2
to input in this mode.
This mode cannot be used in low-speed mode.
If the value of the CNTR
2
active edge switch bit is changed
during one-shot generating enabled or generating one-shot
pulse, then the output level from CNTR
2
pin changes.
6. All modes
Timer Z write control
Which write control can be selected by the timer Z write control
bit (bit 3) of the timer Z mode register (address 002A
16
), writing
data to both the latch and the timer at the same time or writing
data only to the latch.
When the operation “writing data only to the latch” is selected,
the value is set to the timer latch by writing data to the address of
timer Z and the timer is updated at next underflow. After reset
release, the operation “writing data to both the latch and the timer
at the same time” is selected, and the value is set to both the latch
and the timer at the same time by writing data to the address of
timer Z.
In the case of writing data only to the latch, if writing data to the
latch and an underflow are performed almost at the same time,
the timer value may become undefined.
Timer Z read control
A read-out of timer value is impossible in pulse period
measurement mode and pulse width measurement mode. In the
other modes, a read-out of timer value is possible regardless of
count operating or stopped.
However, a read-out of timer latch value is impossible.
Switch of interrupt active edge of CNTR
2
and INT
1
Each interrupt active edge depends on setting of the CNTR
2
active edge switch bit and the INT
1
active edge selection bit.
Switch of count source
When switching the count source by the timer Z count source
selection bits, the value of timer count is altered in
inconsiderable 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.