
112
EPSON
S1C88409 TECHNICAL MANUAL
CHAPTER 5: PERIPHERAL CIRCUITS AND OPERATION (16-bit Programmable Timer)
Compare data register
The programmable timer has a built-in data
comparator so that count data can be compared
with an optional value. The compare data register
(CDR) is used to set the value to be compared.
In the 8-bit mode, it is used as two 8-bit registers
CDR0 (Timer 0) and CDR1 (Timer 1) separate for
each timer.
In the 16-bit mode, the CDR0 register is handled as
low-order 8 bits of compare data, and the CDR1
register is as high-order 8 bits.
The compare data register can be read and written,
and both the CDR0 and CDR1 registers are set to
00H at initial reset.
The programmable timer compares count data
with the compare data register (CDR), and gener-
ates a compare match signal when they become
the same value. This compare match signal
generates an interrupt, and controls the clock
(TOUT signal) output.
Timer operation
Timer 0 and Timer 1 are equipped with PTRUN0
(Timer 0) and PTRUN1 (Timer 1) registers which
control the RUN/STOP of the timer. The program-
mable timer starts down counting by writing "1" to
the PTRUN register. However, it is necessary to
control the input clock and to preset the reload
data before starting a count.
When "0" is written to PTRUN register, clock input
is prohibited, and the count stops.
This RUN/STOP control does not affect data in the
counter. The data in the counter is maintained
during count deactivation, so it is possible to
resume counting from the data.
In the 8-bit mode, the channels can be controlled
individually by the PTRUN0 register and the
PTRUN1 register.
In the 16-bit mode, the PTRUN0 register controls
both channels as a 16-bit timer. In this case, control
of the PTRUN1 register is invalid.
The buffers PTM0 (Timer 0) and PTM1 (Timer 1)
are attached to the counter, and reading is possible
in optional timing.
When the counter agrees with the data set in the
compare data register during down counting, the
timer generates a compare match interrupt.
And, when the counter underflows, an underflow
interrupt is generated, and the initial value set in
the reload data register is loaded to the counter.
The interrupt generated does not stop the down
counting.
After an underflow interrupt is generated, the
counter continues counting from the initial value
reloaded.
PTRUN0(1)
PSET0(1)
RDR0(1)
CDR0(1)
Input clock
PTM07(17)
PTM06(16)
PTM05(15)
PTM04(14)
PTM03(13)
PTM02(12)
PTM01(11)
PTM00(10)
A6H
58H
A6H
58H
F3H
Preset
Reload &
Underflow interrupt
generation
Compare match
interrupt generation
Fig. 5.12.4.1 Basic operation timing of counter (an example of 8-bit mode)