Home / Learn Embedded C / What Is a DAC?

What Is a DAC?

A Digital-to-Analog Converter — the reverse of an ADC, producing a real voltage from a digital number.

The short versionA Digital-to-Analog Converter — the reverse of an ADC, producing a real voltage from a digital number.

Theory in plain words

PWM vs true DAC outputPWM "fake analog"Fast digital switching,averaged by eye/inertia/filterSimple, uses a plain digitalpinTrue DAC outputGenuinely continuous analogvoltage, no switchingNeeds a DAC-capablepin/peripheral
PWM vs true DAC output

Definition

A DAC (Digital-to-Analog Converter) takes a digital number and produces a corresponding continuous analog voltage output — the reverse operation of an ADC.

Why you need this

Generating an actual analog waveform (an audio tone, a smoothly varying control voltage) needs a true DAC output, which behaves differently from the simulated-analog PWM technique covered earlier.

How it works

Unlike PWM (which approximates an average voltage by fast switching), a DAC outputs a genuinely continuous voltage directly, without needing any external filtering to "smooth out" switching edges.

Where you'll see this

  • Audio generation
  • Analog control signals
  • Waveform synthesis

Try it

Comparing a PWM-approximated level against a true DAC valueC: edit and run

Both land near the same value here, but the PWM figure is only a time-averaged approximation while the DAC value is a direct, continuous voltage.

Try it: sweeping a DAC through several direct voltage levels

Writing a sequence of digital codes directly out a DACC: edit and run

Each code here produces an immediate, continuous output voltage — no switching or averaging involved, unlike PWM.

Test what you just read

1. How does a true DAC output differ fundamentally from a PWM "simulated analog" signal?