
16 Stopwatch Timer (SWT)
S1C17003 TECHNICAL MANUAL
EPSON
16-5
SWT
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
(approximate 10 Hz), and 1 Hz signal falling edges. If interrupts are permitted, interrupt requests are sent to the
interrupt controller (ITC).
BCD100[0]
BCD100[1]
BCD100[2]
BCD100[3]
100 Hz interrupt
10 Hz interrupt
1/100-
second
counter
BCD data
1/10-
second
counter
BCD data
BCD10[0]
BCD10[1]
BCD10[2]
BCD10[3]
1 Hz interrupt
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
0
Figure 16.5.1: Stopwatch timer timing chart
Note: The stopwatch timer switches to Run/Stop mode when data is written to SWTRUN
synchronized 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.
SWTRUN(WR)
SWT_BCNT register
27
28
29
30
31
32
SWTRUN(RD)
256Hz
Figure 16.5.2: Run/Stop control timing chart