Jump to content
gonya707

AD9850 (DDS function generator) for Energia

Recommended Posts

This is the Energia version of the library I shared here. You can find this function generator module easily in eBay for about $5

 

It has the same functions but this time the library features a object-oriented structure, which allows to manage several AD9850 modules at once. It works perfectly for both MSP430 and Stellarpad boards (tested), you just need to change the given pin numbers when you create the AD9858 class instance.

class AD9850{
		 public:
			AD9850(int givenW_CLK, int givenFQ_UD, int givenDATA, int givenRESET);
			void init();
			void doReset();
			void osc(double Freq,double phase);
			void sweepUp(double minFreq, double maxFreq, double inc, int cyclesPerDelay);
			void sweepDown(double minFreq, double maxFreq, double inc, int cyclesPerDelay);
			void sweepLoop(double minFreq, double maxFreq, double inc, int cyclesPerDelay);
			void powerDown();
		 private:
			int W_CLK;
			int FQ_UD;
			int DATA;
			int RESET;
};

This is a main code example for the Stellarpad:

#include "ENERGIA_AD9850.h"

void setup(){

    pinMode(PE_5, OUTPUT);
    pinMode(PA_5, OUTPUT);
    pinMode(PA_6, OUTPUT);
    pinMode(PA_7, OUTPUT);
  
    AD9850 device(PE_5, PA_5, PA_6, PA_7);
    device.init();
    device.doReset();
    
    // min frequency = 1Hz, max frequency = 10000Hz
    // 1Hz steps, waiting 1000 Cycles between changing frequency.
    device.sweepLoop(1, 10000, 1, 1000);
}

void loop(){} //do nothing

And the result will be something like this:

 

dhlQzJ4.gif

 

 

You can download the codes attached to this post. Please unlock cpp and .h this time :P sorry for the inconvenience.

 

You can temporally download them here. 

 

 

 

.cpp

.h

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×