Epson S1C17624 Technical Manual page 127

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

11 16-BiT TiMeRS (T16)
Example 1) When measuring a pulse width
Internal count clock
External input signal
Counter (CKACTV = 1)
Example 2) When detecting a pulse that exceeds the specified width
Internal count clock
External input signal
Counter (CKACTV = 0)
Figure 11.
11.4
Count Mode
The T16 module features two count modes: repeat mode and one-shot mode. These modes are selected using
TRMD/T16_CTLx register.
Repeat mode (TRMD = 0, default)
Setting TRMD to 0 sets T16 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. T16 should be set to this mode to generate periodic in-
terrupts or A/D conversion triggers at desired intervals or to generate a serial transfer clock.
One-shot mode (TRMD = 1)
Setting TRMD to 1 sets T16 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. T16 should be set to this mode to set a specific wait time or for
pulse width measurement.
11.5
Reload Data Register and underflow Cycle
The reload data register T16_TRx 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 the timer is reset or the coun-
ter underflows. If the timer is started after resetting, it 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 conversion triggers, and the programmable serial interface
transfer clock.
11-4
PRUN
0x0
PRUN
n
3.3.1 Count Operation in Pulse Width Measurement Mode
Seiko epson Corporation
0xff 0xfe 0xfd
n+3 n+2 n+1
n-1
n-2
n-3
0x2 0x1 0x0
S1C17624/604/622/602/621 TeChniCal Manual
n
n
Underflow interrupt

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c17604S1c17622S1c17602S1c17621

Table of Contents