S1C88348/317/316/308 TECHNICAL SOFTWARE
EPSON
II-67
12 PROGRAMMABLE TIMER
(Invalid)
Specifications
Vector address setting for programmable timer interrupt
(4) measure_init, measure_intr, k1x_intr: Initialization and interrupt processing for 16-bit pulse
width measurement timer
This is an example of using the programmable timer as a 16-bit pulse width measurement timer
and performs the following settings:
Count mode
16-bit x 1
Pulse output channel
Timer 0
Pulse external (TOUT) output
OFF
<Timer 0>
Timer mode
Pulse width measurement timer (reload mode)
Measurement period
During LOW input
Count clock
fOSC3 x 1/1
Reload data
0FFFFH (Pulse width measurement timer initial value)
<Timer 1>
Cannot be used
After setting the above, it enables the timer 1 and K10 input interrupts, and starts the timer. The
interrupt level has been set at IRQ3 and an interrupt is generated by the overflow of the timer or
K10 input.
Since the fall (count start) and rise (count completion) timings of the K10 input cannot be evaluated
by programmable timer control only, a K10 input interrupt is used. Furthermore, in order to be able
to generate an interrupt at both falling and rising timings, input interrupt timing is reversed by
each interrupt generation in the K1x interrupt processing routine.
K10 input
KCP10 register
Count clock
K10 interrupt
(Valid)
Fig. 12.2 Timing of K10 input interrupt generation
Vector address setting for programmable timer interrupt
(5) pulsout_init: 16-bit reload timer pulse output
Outputs TOUT signal from the R27 terminal using the programmable timer as 16-bit reload timer.
Count mode
16-bit x 1
Pulse output channel
Timer 0
Pulse external (TOUT) output
ON
<Timer 0>
Timer mode
Programmable timer (reload mode)
Count clock
fOSC3 x 1/4
Reload data
33,200 (= 33.2 msec, when fOSC3 is 4 MHz)
<Timer 1>
Cannot be used
According to the above setting, the clock cycle of the TOUT signal is set at 66.4 msec (approxi-
mately 15 Hz).