DIY Discrete R-2R Ladder DAC: Serial Data Demultiplexing - diyAudio
Go Back   Home > Forums > Source & Line > Digital Line Level

Digital Line Level DACs, Digital Crossovers, Equalizers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 8th February 2012, 02:30 PM   #1
diyAudio Member
 
b1o2r3i4s5's Avatar
 
Join Date: Feb 2012
Location: HK
Default DIY Discrete R-2R Ladder DAC: Serial Data Demultiplexing

Hello,
This is my first thread and I have a problem with demultiplexing the digital PCM audio data stream.

Recently I designed a discrete R-2R DAC using information from the I2S spec sheet and wiki,
but when i first tested it, the output wave is split in 2: upper part and lower part.

I later found out that the PCM stream is coded as a signed integer using the 2's compliment method
but the shift-register can only decode a unsigned integer.

My question is if theres anyway I could change the signed PCM stream into unsigned?
OR
Is there another way of decoding this PCM Stream?

Thanks,
Boris
  Reply With Quote
Old 8th February 2012, 03:02 PM   #2
oshifis is offline oshifis  Hungary
diyAudio Member
 
Join Date: Mar 2004
Location: Budapest, Hungary
You need to invert the MSB.
  Reply With Quote
Old 8th February 2012, 03:09 PM   #3
diyAudio Member
 
b1o2r3i4s5's Avatar
 
Join Date: Feb 2012
Location: HK
Thanks for your Advice
But i have tried that and it seems that the mid-point is out of place
is there a way to fix it?
Another question: the output wave seems to have some of its voltage levels shifted vertically, is this caused by the resistor errors in the R-2R ladder?
I will try to get a photo from my oscilloscope ASAP.
Thanks,
Boris
  Reply With Quote
Old 8th February 2012, 05:54 PM   #4
diyAudio Member
 
Join Date: Jan 2008
Location: Virginia
Invert (and add one) will give the "inverse" voltage:
http://en.wikipedia.org/wiki/Two's_c...27s_complement

Last edited by SoNic_real_one; 8th February 2012 at 05:59 PM.
  Reply With Quote
Old 8th February 2012, 06:37 PM   #5
diyAudio Member
 
b1o2r3i4s5's Avatar
 
Join Date: Feb 2012
Location: HK
but how exactly do I "Add 1" to a digital stream...
  Reply With Quote
Old 8th February 2012, 07:41 PM   #6
DF96 is offline DF96  England
diyAudio Member
 
Join Date: May 2007
With an adder? You can get a chip which will do this, and deal with carry in and out. Known as a 'full adder'.
  Reply With Quote
Old 8th February 2012, 07:53 PM   #7
diyAudio Member
 
b1o2r3i4s5's Avatar
 
Join Date: Feb 2012
Location: HK
The main problem is that the data is in serial format
  Reply With Quote
Old 8th February 2012, 07:55 PM   #8
oshifis is offline oshifis  Hungary
diyAudio Member
 
Join Date: Mar 2004
Location: Budapest, Hungary
Quote:
Originally Posted by b1o2r3i4s5 View Post
Thanks for your Advice
But i have tried that and it seems that the mid-point is out of place
is there a way to fix it?
Another question: the output wave seems to have some of its voltage levels shifted vertically, is this caused by the resistor errors in the R-2R ladder?
I will try to get a photo from my oscilloscope ASAP.
Thanks,
Boris
What do you mean by "mid-point is out of place"? Digital zero of twos complement (2C) signal is 0000. Maximum positive value is 7FFF, maximum negative value is 8000. If you invert the MSB, these numbers will be 8000 (analog zero), FFFF (maximum positive signal), and 0000 (maximum negative signal), respectively. Exactly the 0000 to FFFF offset binary (OB) span.
  Reply With Quote
Old 8th February 2012, 08:06 PM   #9
diyAudio Member
 
b1o2r3i4s5's Avatar
 
Join Date: Feb 2012
Location: HK
Quote:
Originally Posted by oshifis View Post
What do you mean by "mid-point is out of place"? Digital zero of twos complement (2C) signal is 0000. Maximum positive value is 7FFF, maximum negative value is 8000. If you invert the MSB, these numbers will be 8000 (analog zero), FFFF (maximum positive signal), and 0000 (maximum negative signal), respectively. Exactly the 0000 to FFFF offset binary (OB) span.
By "Out of place" I meant the analogue signal, every time the wave crosses the analogue mid-point a positive spike appears.
  Reply With Quote
Old 8th February 2012, 08:14 PM   #10
oshifis is offline oshifis  Hungary
diyAudio Member
 
Join Date: Mar 2004
Location: Budapest, Hungary
That is called glitch, caused by imperfect switches. Do you have a sample-and-hold circuit after the DAC? That should hold the previous analog level during the glitch. I have built a similar R-2R discrete DAC, but I could reach 10-bit resolution with stock 0,1% resistors. The remaining 6 bits had to be trimmed.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Power R-2R ladder DAC? cuallito Class D 2 3rd May 2011 03:33 PM
DIY discrete dac chip. Lgrau Digital Line Level 114 13th March 2010 05:18 PM
A good way to reduce R-2R DAC linear error AD1865 Digital Source 103 27th May 2005 03:55 PM
CS8415A serial data output jimbo69 Digital Source 0 25th February 2003 04:34 PM
use serial data A'af Digital Source 2 16th January 2002 08:50 PM


New To Site? Need Help?

All times are GMT. The time now is 03:51 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2