This example shows how to use the Capture feature of the Timer Counter (TC) module.
The XMEGA TC driver can be found here.
All AVR XMEGA devices with an tc can be used.
The example will configure one of the device TC modules in frequency capture mode. The event system is configured to trigger a capture when switch 0 is pressed and released. The resulting value (the interval between press and release) is displayed on the leds. Only the lower 8 bits are displayed.
The TC is setup to use a 1000Hz resolution clock and a 32767 period value.
This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.
For further information, visit Microchip.