Pulse Width Measurement Mode - Epson S1C17704 Technical Manual

Cmos 16-bit single chip microcomputer
Table of Contents

Advertisement

11 16-BIT TIMERS (T16)

11.2.3 Pulse Width Measurement Mode

In pulse width measurement mode, the internal clock is supplied to the counter only while an external pulse input
from the external clock port is at the active level specified. This makes it possible to generate an interrupt when a
pulse longer than a specified width is input or to measure the input pulse width.
Pulse input port
The I/O ports used to input external pulses are the same as the external clock mode (see Table 11.2.2.1).
Set the I/O port, which corresponds to the timer channel used, to input mode and input pulses to be measured
from the I/O pin.
Selecting the count clock
As in the case of the internal clock mode, the timer operates with the prescaler output clock selected using
DF[3:0] (D[3:0]/T16_CLKx register). Select an appropriate clock according to the approximate input pulse
width and measurement accuracy (see Table 11.2.1.1).
Selecting the signal polarity
Use CKACTV (D10/T16_CTLx register) to select the active level for the pulse to be measured. When
CKACTV is 1 (default), the high period of the input pulse will be measured; when it is set to 0, the low period
will be measured.
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.2.3.1 Count Operation in Pulse Width Measurement Mode
11-4
PRUN
0x0
PRUN
n
0xff 0xfe 0xfd
n-1
n-2
n-3
EPSON
n+3 n+2 n+1
n
0x2 0x1 0x0
n
Underflow interrupt
S1C17704 TECHNICAL MANUAL

Advertisement

Table of Contents
loading

Table of Contents