14 8-BIT TIMERS (T8)
14-2
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
Count Clock
14.2
The count clock is selected by DF[3:0]/T8_CLK
x
register from the 15 types generated by the prescaler dividing the
PCLK* clock into 1/1 to 1/16K.
*
T8 Ch.0, 2, 4, and 6 use the PSC Ch.0 output clocks generated from PCLK1. T8 Ch.1, 3, 5, and 7 use the PSC
Ch.1 output clocks generated from PCLK2. The descriptions in this chapter use PCLK as PCLK1 and PCLK2.
2.1 Count Clock (PCLK Division Ratio) Selection
Table 14.
DF[3:0]
Division ratio
DF[3:0]
Division ratio
0xf
Reserved
0x7
1/128
0xe
1/16384
0x6
1/64
0xd
1/8192
0x5
1/32
0xc
1/4096
0x4
1/16
0xb
1/2048
0x3
1/8
0xa
1/1024
0x2
1/4
0x9
1/512
0x1
1/2
0x8
1/256
0x0
1/1
(Default: 0x0)
Notes: • The prescaler must run before T8 can operate.
• Make sure the counter is halted before setting the count clock.
For detailed information on the prescaler control, see the “Prescaler (PSC)” chapter.
Count Mode
14.3
T8 features two count modes: repeat mode and one-shot mode. These modes are selected using TRMD/T8_CTL
x
register.
Repeat mode (TRMD = 0, default)
Setting TRMD to 0 sets T8 to repeat mode.
In this mode, once the count starts, the timer continues running until stopped by the application program. When
the counter underflows, the timer presets the reload data register value into the counter and continues the count.
Thus, the timer periodically outputs an underflow pulse. T8 should be set to this mode to generate periodic in-
terrupts or A/D triggers at desired intervals or to generate a serial transfer clock.
One-shot mode (TRMD = 1)
Setting TRMD to 1 sets T8 to one-shot mode.
In this mode, the timer stops automatically as soon as the counter underflows. This means only one interrupt
can be generated after the timer starts. Note that the timer presets the reload data register value to the counter,
then stops after an underflow has occurred. T8 should be set to this mode to set a specific wait time.
Note: Make sure the counter is halted before setting the count mode.
Reload Data Register and Underflow Cycle
14.4
The reload data register T8_TR
x
is used to set the initial value for the down counter.
The initial counter value set in the reload data register is preset to the down counter if T8 is reset or the counter un-
derflows. If T8 is started after resetting, the timer counts down from the reload value (initial value). This means that
the reload value and the input clock frequency determine the time elapsed from the point at which the timer starts
until the underflow occurs (or between underflows). The time determined is used to obtain the specified wait time,
the intervals between periodic interrupts or A/D triggers, and the programmable serial interface transfer clock.