Electronic – Why don’t microcontrollers generally have on-chip DACs


In this answer I read that microcontrollers usually don't have DACs, while they do have ADC. Why is that?

I appreciate that integrating resistors like in an R-2R DAC is expensive in terms of real-estate (thanks Mike, for your answer), but I thought switched current DACs can be made very small since they only need a handful of transistors.

Best Answer

First, some microcontrollers DO have D/A converters. However, these are far less common than A/D converters.

Aside from the technical issues, the main reason is market demand. Think about it. What kind of application would require a real D/A? It is quite rare to want a micro to produce a reasonably high speed analog signal unless the point is signal processing. The main market for that however is audio, and that needs a lot more resolution than you can build with the same process used to make the digital microcontroller. So audio will use external A/Ds and D/As anyway. DSPs that are intended for such applications have communication hardware built in to talk to such external devices, like I2S.

Otherwise for ordinary control applications, the strategy is to convert to digital as early in the process and then keep things digital. This argues for A/Ds, but D/As are useless since you don't want to go back to analog.

Things that microcontrollers typically control are controlled with PWM (PulseWidth Modulation). Switching power supplies and class D audio inherently work on pulses. Motor control, solenoid control, etc, is all done with pulses for efficiency. You want the pass element to be either fully on or fully off because a ideal switch can't dissipate any power. In large systems or where input power is scarce or expensive (like battery operation), the efficiency of switching systems is important. In a lot of medium cases the total power used isn't the issue, but getting rid of wasted power as heat is. A switching circuit that dissipates 1 W instead of 10 W may cost a little more in electronic parts than the 10 W linear circuit, but is a lot cheaper overall because you don't need a heat sink with associated size and weight, possibly forced air cooling, etc. Switching techniques also are usually tollerant of a wider input voltage range.

Note that PWM outputs, which are very common in microcontrollers, can be used to make analog signals in the unusual cases where you need them. Low pass filtering a PWM output is the easiest and nicest way to make a analog signal from a micro as long as you have sufficient resolution*speed product. Filtered PWM outputs are nicely monotonic and highly linear, and the resolution versus speed tradeoff can be useful.

Did you have anything specific in mind you wished a micro had a D/A converter for? Chances are this can be solved with low pass filtered PWM or would need a external D/A for higher resolution*speed anyway. The gap between filtered PWM and external is pretty narrow, and the type of applications that actually need such a signal is also narrow.