Joined: 15 Dec 2007 Posts: 627 Location: Cleveland, OH
Posted: Tue Feb 14, 2017 10:04 pm Post subject: Xmega32 E5 DDS Sine Wave Signal Generator Example
The following is a simple DDS Sine Wave Generator for the Xmega E5 series.
It is not a Direct Digital Synthesis tutorial, but if you are familiar with the concept it should make sense.
Basically one has a signal lookup table, (Sine, Square, Triangle, etc.), and runs an ISR at a fixed, fast, rate.
One calculates the next sample to output based upon the desired output frequency, table size, and DAC update rate.
This program is set up for a 62.5 kHz DDS ISR, (sample update rate).
The number of samples the output signal has is fixed at 62.5 k samples / Second.
A 1 Hz sine wave would have 62.5 K samples for one Period of the sine wave.
A 1 KHz sine wave would have 62.5 samples per one Period of the sine wave.
A 10 KHz sine wave would have 6.25 samples per one Period of the sine wave.
Know that even a simple first or second order Low Pass Filter will significantly clean up the output signal by removing the higher frequency components of the "stair-step" signal.
There is certainly room for improvement, but this demonstrates a working example of the concept.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum