Hardware Reference
In-Depth Information
Pulse width
Rising edge
Falling edge
Figure 8.10
■
Pulse-width measurement using input-capture
•
Interrupt generation
. All input-capture pins can serve as edge-sensitive interrupt
sources. Once enabled, interrupts will be generated on the selected edge(s).
•
Event counting
. An event can be represented by a signal edge. An input-capture
channel can be used in conjunction with an output-compare function to count the
number of events that occur during an interval. An event counter can be set up
and incremented by the input-capture interrupt service routine. This application is
illustrated in Figure 8.11.
e
3
e
1
e
2
e
4
e
i
e
j
...
...
Start of
interval
End of
interval
Figure 8.11
■
Using an input-capture function for event counting
•
Time reference
. In this application, an input-capture function is used in conjun-
ction with an output-compare function. For example, if the designer wants to
activate an output signal a certain number of clock cycles after detecting an input
event, the input-capture function would be used to record the time at which the
edge is detected. A number corresponding to the desired delay would be added to
this captured value and stored to an output-compare register. This application is
illustrated in Figure 8.12.
Time
t
0
Time
t
0
+ delay
Time of reference
(set up by signal edge)
Time to activate
output signal
(set up by output-compare)
Figure 8.12
■
A time-reference application
•
Duty cycle measurement
. The
duty cycle
is the percent of time that the signal is
high within a period in a periodic digital signal. The measurement of the duty cycle
is illustrated in Figure 8.13.
Search WWH ::
Custom Search