Main Page | File List | Globals | Related Pages

AVR136: Low-Jitter Multi-Channel Software PWM Documentation

Atmel AVR Application Note

Introduction

This documents data structures, functions, variables, defines, enums, and typedefs in the software for application note AVR136.

Compilation Info

This software was written for the both IAR Embedded Workbench 4.11A and GCC 3.4.3.

To make project when using IAR Embedded Workbench:

  1. Add the file t2313_softpwm.c to project.
  2. Under processor configuration, select ATtiny2313
  3. Enable bit definitions in I/O include files

Device Info

The included source code is written for ATtiny2313, using the STK500 platform with a 7.3728MHz external crystal.

Target Setup

Channels are mapped to specific port pins in the t2313_softpwm.h file

PWM frequency and crystal selection

The PWM base frequency is the crystal frequency divided by 65536, e.g. for a 7.3728MHz crystal the PWM base frequency will be 112.5Hz. The standard STK500 3.6864MHz oscillator could be used as a clock source, but the PWM base frequency would be reduced which may result in unacceptable ripple. Jitter will be +/-1 clock cycle max, or +/-0.0015% of base frequency.

This demonstration shows ten PWM channels, for GCC the ISR uses less than 50% of processing time during the softcount=0 interrupt. The principles shown should accomodate up to 24 channels on suitable AVR devices whilst maintaining PWM accuracy, ISR optimisation may improve this even further.

ToDo List

Todo:
Select if ISR Timing Debugging is desired in DEBUG.

Original author

Andy Gayne is the original author of this application note.
Generated on Tue Dec 20 15:11:31 2005 for AVR136: Low-Jitter Multi-Channel Software PWM by  doxygen 1.4.4