Jump to content
43oh

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

 

Link to post
Share on other sites
  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...