[sdiy] ADC/DAC to Microprocessor for Audio

Fredrik Carlqvist ifrc at iar.se
Tue Nov 16 12:18:02 CET 2004


The built in ADC in some PIC18 derivatives (18F2331 for example) have a
"high speed ADC", 200kHz at 10 bits. Add a 10-stage R-2R ladder to it, and
you have a complete DSP system. Microchip also has a cheap 12-bit DAC. And
all PIC18's have a multiply instruction (unsigned 8-bit).

I have experimented a bit with this kind of applications. Use a slightly
larger integer type than your data and use the extra bits as a guard. 

For example, with 10-bit audio, use 16-bit arithmetic. Multiplication is
straightforward. Probably you'll want a 'fixed point' multiplication. Just
throw away (or better still, don't bother to compute) the lower bytes of the
result. 

For a saturated addition (over/underflow handling, assuming unsigned
arithmetic), look at the 'guard bits': first check if bit 15 is set (result
was negative/underflowed), if so, saturate to 0. Then check if any of bits
10-14 are set, if so, saturate to 0x3FF. 

At 40MHz, the PIC18 does 10MIPS, which gives you 250 instructions per audio
sample at 40kHz. If you are clever/careful, you can do a lot with that. I
think it is more fun to squeeze the last bit out of a PIC18 than to buy a
brute force actual DSP. 

And then there is dsPIC... Jumsi! It actually has MAC instructions. And a
100kHz 12-bit ADC... It's a complete sound processor/synthesizer waiting to
happen!

Take care, and beware the feature creep ;-D !


Fredrik C

________________________________________
From: owner-synth-diy at dropmix.xs4all.nl
[mailto:owner-synth-diy at dropmix.xs4all.nl] On Behalf Of William Berzinskas
Sent: Tuesday, November 16, 2004 04:38
To: synth-diy at dropmix.xs4all.nl
Subject: [sdiy] ADC/DAC to Microprocessor for Audio

Looking over the net,  it seems the general consensus is to not try what i
want to do..  but all that aside..
 
What circuitry is need to go into a adc and out of a dac for use with audio
and a pic18?   most likely, the adc/dac would be single supply (i'm mostly
limited to dip here)..  so, i'd need to deal with that..  
 
also what kind of input filtering is necessary?   and whats this about
output reconstruction filter?    
 
 
 
On a side note..  I've tried some simple stuff like this before, but no good
results because the aforementioned were not handled..  just trying to sample
and output data..    one thing i noticed.  for instance: if i was working
with 8 bits..  how would i handle situations that caused an overflow?  is
there some averaging of bits here or something i should be aware of? 
 
thanks in advance
--billie blaze
 





More information about the Synth-diy mailing list