
143
8210C–AVR–09/11
Atmel AVR XMEGA D
Figure 12-13.
Pulse width capture of an external signal.
12.7.4
32-bit Input Capture
Two timer/counters can be used together to enable true 32-bit input capture. In a typical 32-bit
input capture setup, the overflow event of the least-significant timer is connected via the event
system and used as the clock input for the most-significant timer.
The most-significant timer will be updated one peripheral clock period after an overflow occurs
for the least-significant timer. To compensate for this, the capture event for the most-significant
timer must be equally delayed by setting the event delay bit for this timer.
12.7.5
Capture Overflow
The timer/counter can detect buffer overflow of the input capture channels. When both the buffer
valid flag and the capture interrupt flag are set and a new capture event is detected, there is
nowhere to store the new timestamp. If a buffer overflow is detected, the new value is rejected,
the error interrupt flag is set, and the optional interrupt is generated.
12.8
Compare Channel
Each compare channel continuously compares the counter value (CNT) with the CCx register. If
CNT equals CCx, the comparator signals a match. The match will set the CC channel's interrupt
flag at the next timer clock cycle, and the event and optional interrupt are generated.
The compare buffer register provides double buffer capability equivalent to that for the period
buffer. The double buffering synchronizes the update of the CCx register with the buffer value to
either the TOP or BOTTOM of the counting sequence according to the UPDATE condition. The
synchronization prevents the occurrence of odd-length, non-symmetrical pulses for glitch-free
output.
12.8.1
Waveform Generation
The compare channels can be used for waveform generation on the corresponding port pins. To
make the waveform visible on the connected port pin, the following requirements must be
fulfilled:
Pulsewitdh (t
p
)
external signal
events
CNT
MAX
BOTTOM
"capture"