Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TC Example2 for EVK1101 Documentation

Introduction

This is the documentation for the data structures, functions, variables, defines, enums, and typedefs for the TC driver.
It also gives an example of the usage of the TC module.

This example involves 2 timer/counter channels, one configured in capture mode (input) and the other configured in waveform mode (output) to generate a PWM on the output.

Channel 1 of a timer/counter module is used with the input pin TIOA1. You will find the port and pin number in the datasheet of your device. The selected timer input clock is the internal clock labelled TC4 referred to as TIMER_CLOCK4 in the datasheet.

Channel 0 of a timer/counter module is used with the output pin TIOA0. You will find the port and pin number in the datasheet of your device. The selected timer input clock is the internal clock labelled TC3 referred to as TIMER_CLOCK3 in the datasheet.

Note
  • On the AT32UC3A0512, the input pin is TIOA1 is mapped on PB25 and the output pin TIOA0 is mapped on PB23.
  • On the AT32UC3B0256, the input pin is TIOA1 is mapped on PA21 and the output pin TIOA0 is mapped on PB00.
  • On the AT32UC3A3256, the input pin is TIOA1 is mapped on PA01 and the output pin TIOA0 is mapped on PB05.
  • On the AT32UC3C0512C, the input pin is TIOA1 is mapped on PA22 and the output pin TIOA0 is mapped on PB19.
  • On the ATUC128D3, with the STK600 + RCUC3D routing card setup, the chosen input pin TIOA1 for the Timer/Counter 0(TC0) is mapped on PB00 (PB00 is routed to STK600.PORTE.PE0), and the chosen output pin TIOA1 is mapped on PA11 (PA11 is routed to STK600.PORTB.PB3).
  • On the AT32UC3L064, with the STK600 + RCUC3L0 routing card setup, the chosen input pin TIOA1 for the Timer/Counter 1(TC1) is mapped on PB06 (PB06 is routed to STK600.PORTD.PD6), and the chosen output pin TIOA0 is mapped on PB00 (PB00 is routed to STK600.PORTD.PD0).
  • On the AT32UC3L064, with the AT32UC3L-EK evaluation kit, the chosen input pin TIOA1 for the Timer/Counter 1(TC1) is mapped on PB01, and the chosen output pin TIOA0 is mapped on PB00.

The 16-bit input timer/counter channel will cycle from 0x0000 to 0xFFFF or until a falling edge is detected on the input pin, in which case the counter is captured in RA before being reset then started with the same rules. Consequently, RA is a measure of the input period modulo 16 bits.

The 16-bit output timer/counter channel will cycle from 0x0000 to 0xFFFF, starting at 0x0000 with a high output pin level and lowering the output pin level when it reaches the value of RA extracted from the input timer/ counter while raising the output pin level when it reaches the value of RC left at 0. This will hence produce a PWM output signal with a duty cycle depending on the period of the input signal.

Main Files

Compilation Info

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

Device Info

All AVR32 devices with a TC module can be used. This example has been tested with the following board:

  • EVK1100 evaluation kit
  • EVK1101 evaluation kit
  • EVK1104 evaluation kit
  • STK600 starter kit with the RCUC3L0 routing card, 12MHz crystal in the STK600's crystal socket
  • STK600 starter kit with the RCUC3D routing card, 12MHz crystal in the STK600's crystal socket
  • AT32UC3L-EK evaluation kit
  • AT32UC3C-EK evaluation kit

Setup Information

CPU speed: 12 MHz.

Contact Information

For further information, visit Atmel AVR32.