Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TC Example 4 for xplain Documentation

Introduction

This example shows how to use the Capture feature of the Timer Counter (TC) module.

Main files:

  • tc.c Timer XMEGA Timer Counter driver implementation
  • tc.h Timer XMEGA Timer Counter driver definitions
  • tc_example4.c example application
  • conf_example.h: configuration of the example

TC Driver

The XMEGA TC driver can be found here.

Device Info

All AVR XMEGA devices with an tc can be used.

Description of the example

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.

Compilation Info

This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.

Contact Information

For further information, visit Microchip.