176
8331B–AVR–03/12
Atmel AVR XMEGA AU
Figure 14-11.
Input capture timing.
14.7.2
Frequency Capture
Selecting the frequency capture event action makes the enabled capture channel perform an
input capture and restart on positive edge events. This enables the timer/counter to measure the
period or frequency of a signal directly. The capture result will be the time (T) from the previous
timer/counter restart until the event occurred. This can be used to calculate the frequency (f) of
the signal:
shows an example where the period of an external signal is measured
twice.
Figure 14-12.
Frequency capture of an external signal.
Since all capture channels use the same counter (CNT), only one capture channel must be
enabled at a time. If two capture channels are used with different sources, the counter will be
restarted on positive edge events from both input sources, and the result will have no meaning.
events
CNT
TOP
BOTTOM
Capture 0
Capture 1
Capture 2
Capture 3
f
1
T
---
=
Period (T)
external signal
events
CNT
MAX
BOTTOM
"capture"