Pulse Width Modulation (PWM): Introduction
►IntroductionPulse width Modulation or PWM is one of the powerful techniques used in control systems today. They are not only employed in wide range of control application which includes: speed control, power control, measurement and communication. This tutorial will take you through the PWM basics and implementation of PWM on 8051 and AVR microcontrollers.
►Basic Principal of PWMPulse-width Modulation is achived with the help of a square wave whose duty cycle is changed to get a varying voltage output as a result of average value of waveform. A mathematical explaination of this is given below.
Consider a square wave shown in the figure above.
Ton is the time for which the output is high and
Toff is time for which output is low. Let
Ttotal be time period of the wave such that,

Duty cycle of a square wave is defined as

The output voltage varies with duty cycle as...


So you can see from the final equation the output voltage can be directly varied by varying the
Ton value.
If
Ton is 0,
Vout is also 0.
if
Ton is
Ttotal then
Vout is
Vin or say maximum.
This was all about theory behind PWM. Now lets take a look at the practical implementation of PWM on microcontrollers.
◄ Introduction to PWM | 8051 PWM Example Code | AVR PWM Example Code ►
Back to index