Stopwatch Timer Run/Stop Control - Epson S1C17001 Technical Manual

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

16.5 Stopwatch Timer RUN/STOP Control

Set the following items before starting the stopwatch timer.
(1) If using interrupts, set the interrupt level and permit interrupts for the stopwatch timer. See Section 16.6.
(2) Reset the timer. See Section 16.4.
The stopwatch timer includes SWTRUN (D0/SWT_CTL register) to control Run/Stop.
∗ SWTRUN: Stopwatch Timer Run/Stop Control Bit in the Stopwatch Timer Control (SWT_CTL) Register (D0/0x5020)
The stopwatch timer starts counting when SWTRUN is written as 1. Writing 0 to SWTRUN prevents clock input
and stops the count.
This control does not affect the counter (SWT_BCNT register) data. The counter data is retained even when the
count is halted, allowing resumption of the count from that data.
If SWTRUN and SWTRST are written as 1 simultaneously, the stopwatch timer starts counting after the reset.
Interrupt factors are generated during counting at the corresponding 100 Hz (approximate 100 Hz), 10 Hz (approxi-
mate 10 Hz), and 1 Hz signal falling edges. If interrupts are permitted, interrupt requests are sent to the interrupt
controller (ITC).
0
BCD100[0]
1/100-
BCD100[1]
second
counter
BCD100[2]
BCD data
BCD100[3]
100 Hz interrupt
10 Hz interrupt
BCD10[0]
1/10-
BCD10[1]
second
counter
BCD10[2]
BCD data
BCD10[3]
1 Hz interrupt
Note: The stopwatch timer switches to Run/Stop mode when data is written to SWTRUN synchro-
nized with the 256 Hz signal falling edge. When 0 is written to SWTRUN, the timer switches to
Stop state after counting an additional "+1." 1 is retained for SWTRUN reading until the timer
actually stops.
Figure 16.5.2 shows the Run/Stop control timing chart.
SWT_BCNT register
S1C17001 TECHNICAL MANUAL
1
2
3
4
5
6
7
Figure 16.5.1: Stopwatch timer timing chart
256Hz
SWTRUN(RD)
SWTRUN(WR)
27
Figure 16.5.2: Run/Stop control timing chart
8
9
0
1
2
3
4
28
29
30
31
EPSON
16 STOPWATCH TIMER (SWT)
5
6
7
8
9
0
1
32
2
3
4
193

Advertisement

Table of Contents
loading

Table of Contents