42
\$\begingroup\$

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

edit
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.

\$\endgroup\$
  • \$\begingroup\$ +1 that's a really good question. i've wondered the same as well. \$\endgroup\$ – sybreon Mar 24 '12 at 11:28
  • \$\begingroup\$ I need to measure 2 voltages with A/D's, then generate 2 D/A signals simultaneously. This is to control the current through 2 transistors at the same time. The noise and non-linearity of the single or double pole filtered PWM methods are a real problem. Sometimes you do want to "go back to analog". Looks like the Cypress solution for me. The whole reason to go with a micro in the first place is to reduce the parts count. Adding stuff like outboard D/A's defeats that out of the gate. \$\endgroup\$ – user38633 Mar 13 '14 at 5:14
30
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Apart from audio an Arbitrary Function Generator (ARB) is about the only application I can think of where you can't use PWM. \$\endgroup\$ – stevenvh Mar 24 '12 at 14:59
  • \$\begingroup\$ The only point where a DAC seems useful to me when high resolution is desired AND high speed. A PWM has a limited resolution due to it's counter or timer, and with a certain update speed it requires a very high speed reference. \$\endgroup\$ – Hans Mar 24 '12 at 15:47
  • \$\begingroup\$ The other place it's useful is when you need a trim voltage for some random-offset analoger sensor. \$\endgroup\$ – Rocketmagnet Mar 26 '12 at 9:38
  • 1
    \$\begingroup\$ @Rocket: Trim offsets are very low bandwidth, so a low pass filtered PWM works well for them. That doesn't require much extra parts because you usually want to shift and attenuate the full output range for a trim adjustment anyway. \$\endgroup\$ – Olin Lathrop Mar 26 '12 at 12:46
  • 1
    \$\begingroup\$ I'm not sure how representative of other µc manufacturers, but approximately 10% of PIC µc's have on-board D/A's, I believe they are all 10-bit. 16 PICs (mostly in the PIC24 and dsPIC33 families but a couple PIC16s) have two D/A's. \$\endgroup\$ – tcrosley Sep 23 '13 at 20:39
12
\$\begingroup\$

DACs are relatively expensive in silicon area. Far fewer applications need analogue output than input, and the DAC functionality needed for a large proportion of applications can be achieved more cheaply using PWM and a small amount of external filtering.

\$\endgroup\$
6
\$\begingroup\$

Two further issues, not yet mentioned:

  • There are many cases where a part will need to be able to measure the voltages on many pins, but not simultaneously. It is possible to use a single ADC along with one pass-gate per pin to accomplish this. By contrast, most parts which would need multiple DAC outputs would need them simultaneously.

  • The circuitry that interfaces an ADC to the outside world has to be able to transfer only enough current to charge or discharge any deliberate or parasitic capacitance on the ADC's input circuitry. Not only is that a pretty tiny amount of current, but it's essentially independent of the application. The extra area required to handle for "worst-case" current-handling requirements would be negligible compared with what would be required for something that could work in favorable application circumstances. By contrast, different DAC applications will have different current sourcing or sinking requirements, and the amount of chip area required to handle those requirements would vary enormously. Spending 20% of one's chip area on a couple DACs that precisely fit an application's requirements would be sensible, but spending 20% of the chip area in an application where smaller DACs that only took 5% would have sufficed is less so.

Incidentally, one technique I've not seen used much is to combine a DAC with a PWM. When using an R/2R DAC, it's easy to add an extra input whose weight is the same as the LSB (so e.g. a 3+1-input DAC would have weights of 1/2, 1/4, 1/8, and 1/8). Taking an 8-bit DAC and adding a PWM signal to it may yield a 12-bit result with 1/128 of the noise of a 12-bit PWM, but at a lower cost than using a 12-bit DAC of comparable linearity.

\$\endgroup\$
1
\$\begingroup\$

As Olin said, some MCUs do have DACs. Take a look at the Cypress PSoC3 and PSoC5. They contain up to two DACs. These can be extremely useful in analogue sensing applications which require a trim voltage before amplification.

For example, we used one for measuring the outputs of pressure sensors. Each pressure sensor chip has a random voltage offset. When the MCU resets, it sets the DAC voltage to just less than the output of the sensor. Then amplifies the difference between these voltages.

It's great to be able to have the ADC, DAC, Opamps and MCU all in one chip.

\$\endgroup\$
  • 1
    \$\begingroup\$ About your usage of the DAC with pressure sensor, where you applied the offset voltage. Of course, I don't know the details of your circuitry. But wouldn't it be easier to record the offset in the uC memory and apply correction digitally in firmware? \$\endgroup\$ – Nick Alexeev Mar 26 '12 at 6:29
  • \$\begingroup\$ @NickAlexeevit may not be the best thing, since doing that way you are wasting a fraction of the ADC's range, lowering accuracy. \$\endgroup\$ – clabacchio Mar 26 '12 at 8:25
  • \$\begingroup\$ Exactly. If you want to apply amplification (x50), then you need to have the lowest differential voltage at zero pressure. \$\endgroup\$ – Rocketmagnet Mar 26 '12 at 9:24
0
\$\begingroup\$

Revisiting this in 2017, there are now a number of microcontroller families that include DACs (in addition to the Cypress PSOC and PIC listed above):

  • Analog Devices ADuC70xx
  • Atmel AVR XMEGA (some parts)
  • Infineon XMC4100/XMC4200
  • NXP Kinetis series, others
  • Renesas H8, R8, others
  • Silicon Labs
  • STMicroelectronics some of the STM32 series
  • TI, some of the MSP430 series, also some C2000 series
  • Zilog (with Z8 processor)

Searching on Digikey Product Index > Integrated Circuits (ICs) > Embedded - Microcontrollers gives a list, with one of the columns labelled "Data Converters"

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.