Tag Archives: tutorial

PWM Signal Generation by Using AVR Timers.

In the last tutorial you saw how the PWM technique helps us generate analog signals from a microcontroller. In this tutorial we will see how PWM generation is implemented with microcontrollers. Before you begin please see Introduction to PWM Introduction to AVR Timers Generation of PWM signals is such a common need that all modern microcontrollers like AVR has dedicated hardware for that. The dedicated hardware eliminates the load of generation of PWM signal from software (thus frees the CPU ). Its like asking the hardware to generate a PWM signal of a specific duty cycle and the task of CPU is over. The PWM hardware with start delivering the required signal from one of its PINs while the CPU can continue with other tasks. In AVR microcontrolers PWM signals are generated by the TIMER units. (See AVR Timer Tutorials) . In this tutorial I will give you the basic idea of how PWM signals are generated by AVR timers. Their are two methods by which you can generate PWM from AVR TIMER0 (for ATmega16 and ATmega32 MCUs). Fast PWM Phase Correct PWM Don’t worry from their names they will become clear to you as we go on. First we will be considering the Fast PWM mode. PWM Generation Fundas We will use the simplest timer, TIMER0 for PWM generation.(Note […]