I am currently using PWM with an active third or fourth order butterworth i= n another project... a little board with a 16f876a used as a replacement to= the original pcb inside a 25 key laptop-size usb keyboard to convert it in= a cv-gate keyboard.. I haven't finished it yet because i have to go buying= a couple of other ICs first, in that case i would run at 18MHz, pwm at abo= ut 15kHz to have high speed and all the 10 bits.. and filter at about 200-3= 00 Hz. With a simulator I obtained good results, in the next weeks i'll mak= e and test the board. Anyway, I think 10 or 12 bits should be fine.. I thin= k I I have a couple of mpc4822 but I didn't want to use them now... My idea= is to continously acquire alle the knobs values, sum or subtract them via = software, store them in a memory (so i can quick recall patches, configurat= ions, ...) and use the dac to feed the result in the oscillator circuitery,= so, basically they would be constant values > Date: Wed, 15 Feb 2012 07:59:57 -0500 > To: piclist@mit.edu > From: pic@dtweed.com > Subject: Re: [PIC] or others... Are there any DIP microcontroller with an= alog outputs? >=20 > Jacopo Monegato wrote: > > yes, i think so... I need possibly more than 9 bit precision. What i am > > trying to do is digital control of an analog audio vco. I need veeeeery= low > > noise ;) I know that some brands, like Dave smith instruments use 8 bit > > precision for vcf cutoff and even pitch wheel (in older instruments). I= want > > more. I wanted to avoid PWM. In that case I would have used a third ord= er > > butterworth vcvs to have about 0,5-1 mVpp noise, but i wanted to try > > something else. But, at this point, i guess i'll stay on pwm :/ >=20 > What kind of bandwidth (sample rate) do you need? >=20 > If not more than 100 Hz or so, it sounds like you should consider doing > delta-sigma in firmware, which is much cleaner (easier to filter) than PW= M. > Linearity is excellent, and resolution is really just a question of the > width of the variables you use in the firmware. >=20 > For example, here's some C-ish pseudocode that implements N_CHAN channels= of > 15-bit DAC. The dac_isr() should run as frequently as possible, at least = 10x > to 20x the bandwidth that you desire. If you do this in assembler, then y= ou > can squeeze out another bit of resolution, because then you can use the c= arry > bit out of the addition operation instead of the MSB of the accumulator. = You > might also want to unroll the loop, which makes mapping channels to outpu= t > pins trivial. ("u16" and "u8" denote unsigned 16- and 8-bit integer types= ..) >=20 > struct { > u16 value; /* sets the output level of this channel, 0 - 0x7FFF */ > u16 acc; /* internal accumulator (integrator) */ > } ch[N_CHAN]; >=20 > /* Timer interrupt handler */ > void dac_isr (void) > { > u8 i; > for (i=3D0; i ch[i].acc +=3D ch[i].value; > if (ch[i].acc & 0x8000) { > ch[i].acc &=3D ~0x8000; > /* set the output bit associated with channel i */ > } else { > /* clear the output bit associated with channel i */ > } > } > } >=20 > -- Dave Tweed > --=20 > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist =20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .