Counters for DAC...
siljamicke
Posts: 66
Ok, I need clarification...
The AN001 gives the impression that the DUTY-mode is the most suited for DAC, but I've also seen people stating that the PWM-mode is the way to go... I'm confused...
The AN001 gives the impression that the DUTY-mode is the most suited for DAC, but I've also seen people stating that the PWM-mode is the way to go... I'm confused...
Comments
-Phil
And just because I'm curious, why is it unsuitable for driving inductive loads?
-Phil
I have listened to just one sound driver that used the PWM mode and the result was bad.
Either you will get good resolution and low mixing frequency or you will get high mixing frequency and poor resolution.
And it is harder to implement.
/Johannes
I have trouble understanding the DUTY-mode though. PWM I think i get, at a fixed frequency I alter the length of the high vs. low time of the output, resulting in a power proportionate to the ratio of high vs. low, right? But how does DUTY differ? My best bet so far is that a stream of pulses, all of equal length, is output at a very high frequency, and the number of pulses constitutes the amplitude. Is this somewhat correct?
But wouldn't that mean that the resolution is somewhat overkill for audio DA-conversion? I thought I read that at the lowest counter setting there would be some 50 minutes or so between the pulses, and no filters in the world could ever turn that into a sinusoid of any audible frequency, or am I just terribly mistaken about how this all works?
Don't worry about DUTY mode being "overkill". The main thing is that the output is easy to generate without program hand-holding, and the DUTY doody is easy to filter because the frequency is so high.
But you have not a constant frequency. Instead the shorter of the two puls states (high and low) is always one clock cycle, and the longer is adjusted so that you get the desired high/low ratio. For a 50:50 ratio both states are one clock so you get a frequency of 1/2 the clockfrequency (40MHz @ 80MHz clock). That is ideal for audio because at 50:50 is the virtual zero for audio and therfore low signal amplitudes have a very high PWM frequency. The downside is that the PWM frequency changes havy with the audio signal, and that results in serious EMC noise. That can be a reason for one to use a normal PWM. I would say 50 seconds not minutes But this is only if you use the full 32 bit range (FREQx value of $0000_0001 or $FFFF_FFFF). If you limit the audio amplitude to 1/2 of the possible range (which is still 1.6V), the FREQx range is $4000_0000...$C000_0000, middle is $8000_0000. This give still a very high PWM frequency.
Andy
But then again, I probably won't hear a 40mhz tone...
If I narrow the sweep to the suggested range $4000_0000, to $C000_0000, will some sequences be audible?
And, you're right, some frqx values (those which do not integer-divide 232) can produce (barely) audible subharmonics. Chip has successfully used phase dithering to spread these out to the point that they're virtually inaudible.
-Phil
It really doesn't matter, as long as there aren't any audible tones in the range you suggest. Is the fact that I'm using a 6mhz xtal (96mhz) gonna do much to push the artifacts beyond hearing frequencies? Any pointers to where I might learn about the dithering business you mention?
Thanks guys for you help!
For info on dithering, look at the code for Parallax's Prop-based audio player.
-Phil
This thread will come back alive in the near future when I get my demo board I ordered a few days ago and I actually get to code something instead of filling this forum with all my gibberish! Until then wish me good luck with understanding dithering
You as a professional musician should understand the need for frequencies above 1.6 kHz. A "little" thing called overtones sometimes seems to be neglected by engineers.
Buy the propeller platform instead with a suitable add on.
BTW, download the audio file that is included in the "Listen up C3 owners" thread.
The C3 has got a cutoff frequency of 1.6 kHz as well, and then you will be able to decide for yourself.
/Johannes
Well I ordered the demo board so that I didn't have to solder the VGA connector, what a bummer that I traded that for resoldering smd's, a task predestined to have me have a nervous breakdown as well as a demo board breakdown
I think I'll be using two other pins for my audio then.
Hey, if I toggle wich pins will output audio between my pins and those already prefitted with filter, I have an, admittedly very coarse, "sweepable" filter!
... Just kidding...