Picaxe Direct Digital Synthesis

andrewpro

New Member
Has anyone ever tried DDS with a picaxe? I'm working on more parts of my picaxe winradio type device, and am thinking of using an 18x in a DDS setup to make a CW filter.

Origionally I was only going to output a wide ~15khz signal (like 0-14khz) and dump it into a soundcard, using software to analyze, monitor, and filter it, but I've gotten bit by the "stand alone" bug.

So I really only need a 10khz at most, probably more like 5khz and retune to move things around where needed. I'm going to (hopefully) heterodyne the AF signal and pass it to a ~500hz crystal filter.

Any ideas/comments/flames?
 

hippy

Technical Support
Staff member
Isn't DDS simply a mechanism for stepping through a table and putting a value out which then sets a voltage via a D2A ? The frequency is set by the rate and step distance at which stepping occurs ?

http://www.hit.bme.hu/people/papay/sci/pics/ddsfig1.gif
http://www.circuitcellar.com/library/print/0501/lacoste130/figure1.htm

For A PICAXE that's ...

- RepeatForever:
- index = index + N
- READ index,pins ' pins = TABLE(index)
- GOTO RepeatForever

Assuming 250uS per command at 4MHz, that is about 62uS at 16MHz, theoretically then you could churn out a complete 256 byte, 8-bit resolution table in around 48mS; 21Hz.

Shortening the table would improve that, but at the expense of resolution 128=42Hz, 64=85Hz, 32=170Hz, 16=340Hz, 8=680Hz, 4=1360Hz, 2=2700Hz, 1=5400Hz.

Increasing the stepping rate (N) has the same effect as shortening the table.

I'm not entirely convinced that you are going to get any viable output at the frequencies you hope for, by the time you've hit 3kHz you are already into square wave terrirtory.

Perhaps I've misunderstood something about DDS as I'm not really familiar with the concept ?
 

andrewpro

New Member
yeah, that the basic concept. However, good ole nyquist says we only need two samples per cycle to complete the wave ;)

The best way I could think of is to jsut use a rapidly cycling "let pins=xxxxxxxx" into a D2a, and really only need two points ( a positive and negative, or two positives with an appropriate offset), then you follow it with a low pass filter to round it off. Technically could even just use a pwmout with a filter to round it off, but I dont know how stable that would be.

Looking at your math though, it seems you may be right. How fast can an 18x be overclocked?
 
Top