Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PWM pin of microcontroller, what is it for?

I always see PWM pin in microcontrollers, like in PIC what is/are the use of it?

like image 349
LEMUEL ADANE Avatar asked Feb 18 '11 04:02

LEMUEL ADANE


People also ask

What is PWM pin used for?

Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off.

Why do we need PWM in microcontroller?

PWM operates by adjusting the duty cycle of a waveform according to the configured digital value. By doing so, it can produce an analog signal from a digital output. For example, a 75% duty cycle PWM with a 5V amplitude will result in 3.75V. This principle can be used to dim an LED or the speed of a DC motor.

What is PWM mode in microcontroller?

Pulse Width Modulation in AVR Microcontroller. Pulse Width Modulation (PWM) is a square wave with varying low and high amplitude signal. A general PWM signal is given in a figure below: There are various terms related with the Pulse Width Modulation (PWM):


2 Answers

While PWM is indeed used for motor control, I'd say the main use for PWM is digital to analog conversion, in case the MCU doesn't have a DAC on chip (they most often don't). The PWM duty cycle can be used to represent an analog value, if you connect the PWM output to an op amplifier. This is a quite common design in all kinds of applications.

Most kinds of systems reglating something is using a PWM + an op amp to give an analog output, which can be used to control some sort of hardware. Then this analog output can be read back into the MCU, through an analog to digital converter, and the MCU can alter the PWM duty cycle accordingly.

like image 187
Lundin Avatar answered Oct 17 '22 04:10

Lundin


It stands for Pulse Width Modulation. It's a way to send a simulation of an analog signal using digital equipment, so you can simulate a voltage that's between your high and low voltage.

All I know how to do with it is light up LEDs off an Arduino :-)

like image 34
mblinn Avatar answered Oct 17 '22 03:10

mblinn