8-Bit Timer Run/Stop Control - Epson S1C17001 Technical Manual

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

12 8-BIT TIMER (T8F)

12.6 8-bit Timer RUN/STOP Control

Make the following settings before starting the 8-bit timer:
(1) Set the count mode (One-shot or Repeat). See Section 12.2.
(2) Select the count clock (prescaler output clock). See Section 12.3.
(3) Calculate the initial counter value and set it to the reload data register. See Section 12.4.
(4) Reset the timer and preset the initial value to the counter. See Section 12.5.
(5) If using timer interrupts, set the interrupt level and permit interrupts. See Section 12.9.
To start the 8-bit timer, write 1 to PRUN (D0/T8F_CTL register).
∗ PRUN: Timer Run/Stop Control Bit in the 8-bit Timer Control (T8F_CTL) Register (D0/0x4206)
The timer starts counting down from the initial value or from the current counter value if no initial value was pre-
set. 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 the count.
If Repeat mode is set, the timer continues to count from the reloaded initial value.
Write 0 to PRUN bit to stop the 8-bit timer 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 before writing 1 to PRUN.
Resetting the timer while counting is underway sets the counter to the reload register value and continues the count.
One-shot mode
Count clock
PRESER writing
PRUN
Counter
Interrupt request
Repeat mode
Count clock
PRESER writing
PRUN
Counter
Interrupt request
130
Set by software
n
n-1
1
0
Set by software
n
n-1
1
0
Figure 12.6.1: Count operation
EPSON
Reset by hardware
n
Reset by software
n
n-1
1
0
S1C17001 TECHNICAL MANUAL
n
n-1

Advertisement

Table of Contents
loading

Table of Contents