> Date: Wed, 15 Feb 2012 07:59:57 -0500
> To:
@spam@piclistKILLspam
mit.edu
> From:
KILLspampicKILLspam
dtweed.com
> Subject: Re: [PIC] or others... Are there any DIP microcontroller with analog outputs?
>
> 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 order
> > 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 :/
>
> What kind of bandwidth (sample rate) do you need?
>
> 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 PWM.
> Linearity is excellent, and resolution is really just a question of the
> width of the variables you use in the firmware.
>
> 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 you
> can squeeze out another bit of resolution, because then you can use the carry
> 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 output
> pins trivial. ("u16" and "u8" denote unsigned 16- and 8-bit integer types..)
>
> struct {
> u16 value; /* sets the output level of this channel, 0 - 0x7FFF */
> u16 acc; /* internal accumulator (integrator) */
> } ch[N_CHAN];
>
> /* Timer interrupt handler */
> void dac_isr (void)
> {
> u8 i;
> for (i=0; i<N_CHAN; ++i) {
> ch[i].acc += ch[i].value;
> if (ch[i].acc & 0x8000) {
> ch[i].acc &= ~0x8000;
> /* set the output bit associated with channel i */
> } else {
> /* clear the output bit associated with channel i */
> }
> }
> }
>
> -- Dave Tweed