> For some time now I have been considering how to build a cheap relatively > high quality (~22kHz sample rate) stereo playback device using something > like a PIC12C5XX, serial flash (Atmel etc...) and serial stereo DAC (Cirrus > CS4330) plus an Amp (LM4863) or similar. I just wanted to play a 1 or 2 > second blurp of stereo, but I guess just by changing the flash it could be > longer. You need a total of 44K samples streaming thru your device per second, which leaves an average of 23uS per sample. The fastest clock for a 12C5xx is 4MHz for a 1MHz instruction rate, so you have 23 instructions per sample. That will be tight but possibly doable. Consider that you need to read an external memory, write it to an external D/A, and check for the terminating condition. > This project got lost in the 'things to do' pile, but after looking at the > HAL example project referenced below I have pulled it back out. I am now > wondering if I can replace the DAC above with the PWM output method using > in that example and some filters? What kind of sound quality could I expect? You would need hardware PWM at that frequency and resolution. If this is a hobby project, I would use a 16F876 because it has 2 PWM outputs. This processor can run at 20MHz, which yields a maximum PWM frequency of 78KHz at 8 bit resolution. That gives you plenty of margin to use simple and easy filters on the PWM outputs to get the roughly 10KHz bandwidth you want. In other words, it should work fine. I would synchronize the sample rate with a sub-multiple of the PWM rate. Every fourth PWM period gives you a 19.5KHz sample rate, or every third gives you 26KHz. You would have 64 instructions to load the PWM with the new samples already sitting on a silver platter for that purpose, and the rest of the PWM period to fetch the next samples. At 19.5KHz that would be 192 instructions. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu