Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Timer/Counter (TC) Timeout Example 1 for ATmega329p on STK600 Documentation

Introduction

This simple example shows how to use the Timer/Counter (TC) Timeout Driver to toggle two LEDs at different speeds.

Main files:

TC Timeout Driver

The driver can be found here.

Device Info

All megaAVR devices with a Timer/Counter module can be used.

Setup

The following connections are required on STK600 for this example:

  • For LED output, connect PORTD pin header to LED pin header with a 10-pin cable.
  • For 32KHz clock, connect a wire between 32KHz and TOSC2 on the AUX pin header.

Description of the example

The example will configure a tick speed of 1024 Hz and use two different periodic timeouts to toggle two different LEDs. One will toggle at 1Hz and the other at 1/3Hz.

Compilation Info

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

Contact Information

For further information, visit Microchip.