Counter Underflow; Operations In Repeat Mode; Operations In One-Shot Mode - Epson S1C17W22 Technical Manual

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

6. Set the following T16_nCTL register bits:
- Set the T16_nCTL.PRESET bit to 1. (Preset reload data to counter)
- Set the T16_nCTL.PRUN bit to 1.

11.4.2 Counter Underflow

Normally, the T16 counter starts counting down from the reload data value preset and generates an underflow sig-
nal when an underflow occurs. This signal is used to generate an interrupt and may be output to a specific periph-
eral circuit as a clock (T16 Ch.n must be set to repeat mode to generate a clock). The underflow cycle is determined
by the T16 Ch.n operating clock setting and reload data (counter initial value) set in the T16_nTR register.
The following shows the equations to calculate the underflow cycle and frequency:
TR + 1
T = — — — — — — —
f
CLK_T16_n
Where
T:
Underflow cycle [s]
f
:
Underflow frequency [Hz]
T
TR:
T16_nTR register setting
f
: T16 Ch.n operating clock frequency [Hz]
CLK_T16_n

11.4.3 Operations in Repeat Mode

T16 Ch.n enters repeat mode by setting the T16_nMOD.TRMD bit to 0.
In repeat mode, the count operation starts by writing 1 to the T16_nCTL.PRUN bit and continues until 0 is written.
A counter underflow presets the T16_nTR register value to the counter, so underflow occurs periodically. Select
this mode to generate periodic underflow interrupts or when using the timer to output a trigger/clock to the periph-
eral circuit.
0xffff
Counter
0x0000
Software control
PRESET = 1
Underflow interrupt

11.4.4 Operations in One-shot Mode

T16 Ch.n enters one-shot mode by setting the T16_nMOD.TRMD bit to 1.
In one-shot mode, the count operation starts by writing 1 to the T16_nCTL.PRUN bit and stops after the T16_nTR
register value is preset to the counter when an underflow has occurred. At the same time the counter stops, the T16_
nCTL.PRUN bit is cleared automatically. Select this mode to stop the counter after an interrupt has occurred once,
such as for checking a specific lapse of time.
S1C17W22/W23 TECHNICAL MANUAL
(Rev. 1.3)
(Start counting)
f
= — — — — — — —
T
Underflow cycle
PRUN = 1
Figure 11.4.3.1 Count Operations in Repeat Mode
Seiko Epson Corporation
f
CLK_T16_n
(Eq. 11.1)
TR + 1
PRUN = 0
PRUN = 1
11 16-BIT TIMERS (T16)
T16_nTR
register setting
Time
11-3

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c17w23

Table of Contents