A/D and D/A conversion

When a microcontroller produces an analog voltage by passing a PWM signal through a low-pass filter, what determines the output voltage?

  1. AThe duty cycle of the pulses (the fraction of each period that is on)
  2. BThe color of the pulses
  3. CThe memory capacity of the microcontroller
Show answer and explanation

Answer: A. The duty cycle of the pulses (the fraction of each period that is on)

Averaging a PWM signal with a low-pass filter gives an output of roughly high-level voltage × duty cycle when the low level is 0 V—about 2 V for 40% of 5 V. Resolution is set by the timer's count range, and placing the PWM frequency well above the filter cutoff reduces ripple. Since it produces analog voltages without a dedicated DAC, it is used for LED dimming, motor speed control and simple audio output, but response speed and accuracy trade off against ripple.