Applications of PWM?
Probably the commonest application of PWM is in switching voltage regulators. If you have a dc input voltage of (say) 12 volts and you want 6V, you can produce an on-off waveform of 12V and 0V. 50% of the time the output is 12V and 50% of the time the output is 0V. On average the output is 6V - all you have to do is low-pass filter that on-off waveform with an inductor and capacitor to get a usable 6V.



To the left of the above picture is a PWM signal of low duty cycle and about 3 squares in it changes to a PWM signal of higher duty cycle (that's the blue trace). The yellow trace shows what this might look like if it were low-pass filtered.

Clearly if you only wanted 3V then the output would be switched to the 12V input for 25% of the time. Here's an idea how a synchronous buck regulator does this: -



If you wanted to make an audio amplifier, the percentage of the time spent at 12V would vary to follow the signal you are amplifying. This is called a class D amplifier. Basically it like this: -



The input (a sinewave in the picture) is compared with a triangle wave and the series of output pulses produced have an average value that follows the sine wave shape. Here's how: -



You can easily create PWM with a simple analogue circuit. Here's one from Maxim: -