# Digital to Analog Conversion

See:

George from Romania says:

{Ed: Although they are more often used in A2D converters, Sigma-Delta or } Delta-Sigma is much better then PWM, in both the duty cycle accuracy and the number of instructions.
• sum[n] is an accumulator, similar with the PWM counter
• req[n] is the duty cycle, equivalent of the PWM compare register
• max[n] is the overflow value for the accumulator
• n is the channel number, in this demo there are NO_CH independent "PWM like" channels
```for (n = NO_CH - 1; n >= 0; --n) {	// For each Delta-Sigma modulator
outBits <<= 1;			// Shift previously calculated bits
// Sigma delta modulation algorithm using "synthetic division"
sum[n] += req[n];		// Update integrator value
if (sum[n] < max[n])		// Until overflow
outBits++;		//   LSB = 1
else				// Default is LSB = 0
sum[n] -= max[n];	//   Adjust integrator
}
}
```

Don Hyde says:

An R-2R ladder can be used to turn a group of [digital] output pins into a DAC for a few cents. Below is a 3-bit DAC. Using 3 [digital] output pins (beware of the odball open drain pins, they're no good for this), this circuit will provide 0 - Vcc*(7/8) volts out, with a 2R source impedence.

It can be extended to more bits by replicating the MSB R-2R end of the ladder.

Up to 4 bits can be achieved with 5% resistors.

Up to 6 bits can be achieved with 1% resistors.

...

In many applications, it would be advisable to buffer the output with an op-amp.

A circuit like this can achieve waaay higher output frequencies than PWM, and can be easier to filter, at the expense of using up a bunch of pins.

```OUT o--+-/\/\/\/\----o MSB
|    2R
\
/
\ R
/
|
+-/\/\/\/\----o Middle bit
|    2R
\
/ R
\
/
+-/\/\/\/\----o LSB
|    2R
\
/
\ 2R
/
|
---
///
```

PICList Thread '[EE]: high res DA challenge'

Also:

 file: /Techref/io/d2a.htm, 4KB, , updated: 2015/12/22 09:00, local time: 2018/11/16 00:36, TOP NEW HELP FIND:  54.92.193.89:LOG IN

 ©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?Please DO link to this page! Digg it! / MAKE! /  D2A, Sigma Delta, Digital to Analog Conversion

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
 Did you find what you needed? "No. I'm looking for: " "No. Take me to the search page." "No. Take me to the top so I can drill down by catagory" "No. I'm willing to pay for help, please refer me to a qualified consultant" "No. But I'm interested. me at when this page is expanded."

 PICList 2018 contributors: o List host: MIT, Site host massmind.org, Top posters @20181116 RussellMc, Van Horn, David, Sean Breheny, David C Brown, Isaac M. Bavaresco, Bob Blick, Neil, John Gardner, AB Pearce - UKRI STFC, Harold Hallikainen, * Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr.

.