14 8-BIT TIMERS (T8)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
14-3
One-shot mode
Counter
Repeat mode
Counter
0
1
n-1
n
n
Preset by resetting the timer
Preset by resetting the timer
Preset automatically
Underflow
Preset automatically
(n = Reload data)
0
1
n-1
n
n
Underflow
Timer starts
Timer starts
Preset automatically
0
1
n-1
n
Underflow
4.1 Preset Timing
Figure 14.
The underflow cycle can be calculated as follows:
TR + 1
clk_in
Underflow interval = ———— [s]
Underflow cycle = ———— [Hz]
clk_in
TR + 1
clk_in: Count clock (prescaler output clock) frequency [Hz]
TR:
Reload data (0–255)
Timer Reset
14.5
T8 is reset by writing 1 to PRESER/T8_CTL
x
register. The reload data is preset and the counter is initialized.
RUN/STOP Control
14.6
Make the following settings before starting T8.
(1) Select the count clock (prescaler output clock). See Section 14.2.
(2) Set the count mode (one-shot or repeat). See Section 14.3.
(3) Calculate the initial counter value and set it to the reload data register. See Section 14.4.
(4) Reset the timer to preset the counter to the initial value. See Section 14.5.
(5) When using timer interrupts, set the interrupt level and enable interrupts for the relevant timer channel. See
Section 14.9.
To start T8, write 1 to PRUN/T8_CTL
x
register.
The timer starts counting down from the initial value or from the current counter value if no initial value was preset.
When the counter underflows, the timer outputs an underflow pulse and presets the counter to the initial value. An
interrupt request is sent simultaneously to the interrupt controller (ITC).
If one-shot mode is set, the timer stops counting.
If repeat mode is set, the timer continues counting from the reloaded initial value.
Write 0 to PRUN to stop T8 via the application program. The counter stops counting and retains the current counter
value until either the timer is reset or restarted. To restart the count from the initial value, the timer should be reset be-
fore writing 1 to PRUN.
When the timer is reset during running, the timer loads the reload register value to the counter and continues count-
ing.