16 STOPWaTCh TiMeR (SWT)
16-4
Seiko epson Corporation
S1C17624/604/622/602/621 TeChniCal Manual
notes: • The SWT module interrupt flag must be reset in the interrupt handler routine after a stopwatch
timer interrupt has occurred to prevent recurring interrupts.
• Reset the interrupt flag before enabling SWT interrupts with the interrupt enable bit to prevent
occurrence of unwanted interrupt. The interrupt flag is reset by writing 1.
Control Register Details
16.7
7.1 List of SWT Registers
Table 16.
address
Register name
Function
0x5020
SWT_CTL
Stopwatch Timer Control Register
Resets and starts/stops the timer.
0x5021
SWT_BCNT
Stopwatch Timer BCD Counter Register
BCD counter data
0x5022
SWT_IMSK
Stopwatch Timer Interrupt Mask Register
Enables/disables interrupt.
0x5023
SWT_IFLG
Stopwatch Timer Interrupt Flag Register
Indicates/resets interrupt occurrence status.
The SWT registers are described in detail below. These are 8-bit registers.
note: When data is written to the registers, the “Reserved” bits must always be written as 0 and not 1.
Stopwatch Timer Control Register (SWT_CTl)
Register name address
Bit
name
Function
Setting
init. R/W
Remarks
Stopwatch
Timer Control
Register
(SWT_CTl)
0x5020
(8 bits)
D7–5 –
reserved
–
–
–
0 when being read.
D4
SWTRST
Stopwatch timer reset
1 Reset
0 Ignored
0
W
D3–1 –
reserved
–
–
–
D0
SWTRun
Stopwatch timer run/stop control
1 Run
0 Stop
0
R/W
D[7:5]
Reserved
D4
SWTRST: Stopwatch Timer Reset Bit
Resets the SWT module.
1 (W):
Reset
0 (W):
Ignored
0 (R):
Always 0 when read (default)
Writing 1 to this bit resets the counter to 0x0. When reset in Run state, the timer restarts immediately
after resetting. The reset data 0x0 is retained when in Stop state.
D[3:1]
Reserved
D0
SWTRun: Stopwatch Timer Run/Stop Control Bit
Controls the timer Run/Stop.
1 (R/W): Run
0 (R/W): Stop (default)
The timer starts counting when SWTRUN is written as 1 and stops when written as 0. The counter data
is retained at Stop state until a reset or the next Run state.
Stopwatch Timer BCD Counter Register (SWT_BCnT)
Register name address
Bit
name
Function
Setting
init. R/W
Remarks
Stopwatch
Timer BCD
Counter Register
(SWT_BCnT)
0x5021
(8 bits)
D7–4
BCD10[3:0] 1/10 sec. BCD counter value
0 to 9
0
R
D3–0
BCD100[3:0] 1/100 sec. BCD counter value
0 to 9
0
R
D[7:4]
BCD10[3:0]: 1/10 Sec. BCD Counter Value Bits
The 1/10-second counter BCD data can be read out. (Default: 0)
This register is read-only and cannot be written to.
D[3:0]
BCD100[3:0]: 1/100 Sec. BCD Counter Value Bits
The 1/100-second counter BCD data can be read out. (Default: 0)
This register is read-only and cannot be written to.