DAC needed?
John A. Zoidberg
Posts: 514
Hello there,
I've constructed a prototype of a DDS for dsPIC, but I'm stumbled with some issues, especially the limited resolution.
So, I have the signal generated and sampled out like 32 ksps, and with the PWM of 64kHz for the output. The resolution is so limited, it's 5-bit and there is a considerable drop of frequency (one semitone) and the sine wave does not even sound so much like a sine wave.
Previously, I done a similar DDS, on a PIC18F, but with the R-2R network and the sine wave being quite perfect. However I could not continue developing on the PIC18F due to some limitations of the architecture.
So should I switch to an external DAC? Must I need a parallel DAC, or a simple, quick SPI DAC?
Thanks.
I've constructed a prototype of a DDS for dsPIC, but I'm stumbled with some issues, especially the limited resolution.
So, I have the signal generated and sampled out like 32 ksps, and with the PWM of 64kHz for the output. The resolution is so limited, it's 5-bit and there is a considerable drop of frequency (one semitone) and the sine wave does not even sound so much like a sine wave.
Previously, I done a similar DDS, on a PIC18F, but with the R-2R network and the sine wave being quite perfect. However I could not continue developing on the PIC18F due to some limitations of the architecture.
So should I switch to an external DAC? Must I need a parallel DAC, or a simple, quick SPI DAC?
Thanks.
Comments
I see. The thing is, it's just audio level which is around 100 - 2000Hz. That's all about it. It's for the home-made synthesizer or music box.
The PWM resolution is plummeting as I crank up the speed. At 9kHz it's having the maximum duty cycle of 255, and as it went up, the maximum duty cycle will be only less than 50. If I reduce the number of kilosamples in the DAC, I might risk getting lower or distorted frequencies due to the tuning registers went past (2^N)/2.
For your information, the tuning and the accumulators are both 32-bit to simplify the calculation as I'm doing all of these in assembly.
If PWM is not recommended, then I would ditch the idea of using the PWM and try external alternatives.