10 16-BIT TIMERS (T16)
10-4
Seiko Epson Corporation
S1C17M12/M13 TECHNICAL MANUAL
(Rev. 1.2)
0xffff
0x0000
PRESET = 1
PRUN = 1
PRUN = 1
PRUN = 0
PRUN = 1
PRUN = 1
Counter
Software control
Underflow interrupt
Underflow cycle
Time
T16_nTR
register setting
Figure 10.4.4.1 Count Operations in One-shot Mode
10.4.5 Counter Value Read
The counter value can be read out from the T16_
n
TC.TC[15:0] bits. However, since T16 operates on CLK_T16_
n
,
one of the operations shown below is required to read correctly by the CPU.
- Read the counter value twice or more and check to see if the same value is read.
- Stop the timer and then read the counter value.
10.5 Interrupt
Each T16 channel has a function to generate the interrupt shown in Table 10.5.1.
Table 10.5.1 T16 Interrupt Function
Interrupt
Interrupt flag
Set condition
Clear condition
Underflow
T16_nINTF.UFIF
When the counter underflows
Writing 1
T16 provides interrupt enable bits corresponding to each interrupt flag. An interrupt request is sent to the interrupt
controller only when the interrupt flag, of which interrupt has been enabled by the interrupt enable bit, is set. For
more information on interrupt control, refer to the “Interrupt Controller” chapter.
10.6 Control Registers
T16 Ch.
n
Clock Control Register
Register name
Bit
Bit name
Initial
Reset
R/W
Remarks
T16_nCLK
15–9 –
0x00
–
R
–
8
DBRUN
0
H0
R/W
7–4 CLKDIV[3:0]
0x0
H0
R/W
3–2 –
0x0
–
R
1–0 CLKSRC[1:0]
0x0
H0
R/W
Bits 15–9 Reserved
Bit 8
DBRUN
This bit sets whether the T16 Ch.
n
operating clock is supplied in DEBUG mode or not.
1 (R/W): Clock supplied in DEBUG mode
0 (R/W): No clock supplied in DEBUG mode
Bits 7–4
CLKDIV[3:0]
These bits select the division ratio of the T16 Ch.
n
operating clock (counter clock).
Bits 3–2
Reserved
Bits 1–0
CLKSRC[1:0]
These bits select the clock source of T16 Ch.
n
.