S
Spehro Pefhany
- Jan 1, 1970
- 0
(wrong ng first.. 8-( )
Tried a 32MHz PIC24 as a DDS using a 16usec PWM cycle (8 bit), running
from 3.3V. Three 32-bit phase accumulators. I used the Bell 202
frequencies.
With a simple RC filter (5K6/10n -> 10K/10n).. no calculation, just
guesstimated, I get pretty decent behavior (2nd harmonic 35 dB down):-
http://speff.com/Spectrum_1200Hz.BMP
http://speff.com/Spectrum_2200Hz.BMP
http://speff.com/Time_Domain_1200Hz.BMP
I have four simultaneous outputs PWM'd at 62.5kHz (right now, running
from the internal calibrated oscillator, no crystal)
1. 1200Hz sine wave
2. 2200Hz sine wave
3. 1200/2200Hz continuous phase switched by input
4. 1200/2200Hz coherent phase "
(Re) discovered a nasty errata on the PWMs .. even worse than
documented, I think. Avoid 0x0000 as a duty cycle, so I regenerated
the sine table to avoid that.
Only problem I see is that (because of the filter) the two frequencies
have quite different amplitudes.. 1.2V and 1.8V p-p roughly. Could be
solved by a better filter, or do the switching externally, or use sine
tables with different amplitudes.
http://speff.com/Time_Domain_Continuous_Phase.BMP
http://speff.com/Time_Domain_Coherent_Phase.BMP
It would be easy enough to use a crystal and/or to trim the
frequencies with ADC inputs, but the internal oscillator gets pretty
close. Changing the frequencies in the source code is trivial:
Phaseinc1 = 1200.0 * 16E-6 * 256*256*256*256 + 0.5;
Phaseinc2 = 2200.0 * 16E-6 * 256*256*256*256 + 0.5;
Not including the filter, the entire circuit is just the chip itself
and bypass caps (2 x 0.1uF and 1 10uF are the official
recommendations- the latter for the internal 2.5V core regulator
bypass).
Best regards,
Spehro Pefhany
Tried a 32MHz PIC24 as a DDS using a 16usec PWM cycle (8 bit), running
from 3.3V. Three 32-bit phase accumulators. I used the Bell 202
frequencies.
With a simple RC filter (5K6/10n -> 10K/10n).. no calculation, just
guesstimated, I get pretty decent behavior (2nd harmonic 35 dB down):-
http://speff.com/Spectrum_1200Hz.BMP
http://speff.com/Spectrum_2200Hz.BMP
http://speff.com/Time_Domain_1200Hz.BMP
I have four simultaneous outputs PWM'd at 62.5kHz (right now, running
from the internal calibrated oscillator, no crystal)
1. 1200Hz sine wave
2. 2200Hz sine wave
3. 1200/2200Hz continuous phase switched by input
4. 1200/2200Hz coherent phase "
(Re) discovered a nasty errata on the PWMs .. even worse than
documented, I think. Avoid 0x0000 as a duty cycle, so I regenerated
the sine table to avoid that.
Only problem I see is that (because of the filter) the two frequencies
have quite different amplitudes.. 1.2V and 1.8V p-p roughly. Could be
solved by a better filter, or do the switching externally, or use sine
tables with different amplitudes.
http://speff.com/Time_Domain_Continuous_Phase.BMP
http://speff.com/Time_Domain_Coherent_Phase.BMP
It would be easy enough to use a crystal and/or to trim the
frequencies with ADC inputs, but the internal oscillator gets pretty
close. Changing the frequencies in the source code is trivial:
Phaseinc1 = 1200.0 * 16E-6 * 256*256*256*256 + 0.5;
Phaseinc2 = 2200.0 * 16E-6 * 256*256*256*256 + 0.5;
Not including the filter, the entire circuit is just the chip itself
and bypass caps (2 x 0.1uF and 1 10uF are the official
recommendations- the latter for the internal 2.5V core regulator
bypass).
Best regards,
Spehro Pefhany