Sie sind auf Seite 1von 12

WELCOME

Pulse-width modulation (PWM)


What is modulation?
process of varying one or more properties of a periodic waveform, called the
carrier signal with a modulating signal that typically contains information to
be transmitted
PWM

Pulse-width modulation (PWM) is a modulation technique that
controls the width of the pulse, formally the pulse duration
A PWM signal consists of two main components that define its
behaviour: a duty cycle and a frequency
Pulse width modulation (PWM) is a powerful technique for
controlling analog circuits with a microprocessor's digital outputs.

Basic Principal of PWM
Pulse-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.

Duty cycle of a square wave is defined as





So you can see 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.


The output voltage varies with duty cycle as...
How Pulse Width Modulation works
It is a voltage switching between 0v and 12v
A 'suitable device' connected to its output will see the average
voltage and think it is being fed 6v - exactly half of 12v
So by varying the width of the positive pulse - we can vary the
'average' voltage
How Pulse Width Modulation works(continued)
If the switches keep the voltage at 12 for 3 times as long as at 0v, the average will be 3/4 of
12v - or 9v, as shown above.
If the output pulse of 12v lasts only 25% of the overall time, then the average is 25% of 12v -
or 3v.
By varying - or 'modulating' - the time that the output is at 12v (i.e. the width of the positive
pulse) we can alter the average voltage. So we are doing 'pulse width modulation.
The duty cycle & Frequency
Duty cycle
A duty cycle is the percentage of one period in which a signal is
active.

A period is the time it takes for a signal to complete an on-
and-off cycle. As a formula, a duty cycle may be expressed as:

Frequency
The frequency determines how fast the PWM completes a cycle (i.e.
1000 Hz would be 1000 cycles per second), and therefore how fast
it switches between high and low states.





Types

Three types of pulse-width modulation (PWM) are possible:
The pulse center may be fixed in the center of the time window and
both edges of the pulse moved to compress or expand the width.
The lead edge can be held at the lead edge of the window and the tail edge
modulated
The tail edge can be fixed and the lead edge modulated



Steps to write program for PWM
1.Set PWM pins as output
2.Set the PWM period
3.Set the PWM duty cycle by loading appropriate values to registers
4.Configure and start Timer

Thank You

Das könnte Ihnen auch gefallen