12 16-BIT TIMERS (T16)
12-4
Seiko Epson Corporation
S1C31D50/D51 TECHNICAL MANUAL
(Rev. 2.00)
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 12.4.4.1 Count Operations in One-shot Mode
12.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.
12.5 Interrupt
Each T16 channel has a function to generate the interrupt shown in Table 12.5.1.
Table 12.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 CPU core
only when the interrupt flag, of which interrupt has been enabled by the interrupt enable bit, is set. For more infor-
mation on interrupt control, refer to the “Interrupt” chapter.
12.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 during debugging or not.
1 (R/W): Clock supplied during debugging
0 (R/W): No clock supplied during debugging
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
.