gonya707 2 Posted December 7, 2013 Share Posted December 7, 2013 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: You can download the codes attached to this post. Please unlock cpp and .h this time sorry for the inconvenience. You can temporally download them here. .cpp .h RobG, energia, Rickta59 and 1 other 4 Quote Link to post Share on other sites
energia 485 Posted December 17, 2013 Share Posted December 17, 2013 Awesome! Thanks for sharing this with us! Quote Link to post Share on other sites
Bernard 7 Posted January 22, 2014 Share Posted January 22, 2014 Hi, Thank you for this nice library. works here on stellaris. Which pins do you suggest on MSP430G2553 ? Thank you Salutations Quote Link to post Share on other sites
B@tto 51 Posted February 18, 2014 Share Posted February 18, 2014 Hi, nice work ! Looking at the datasheet, serial control seems really closed to SPI transfer. Did you try to work with ? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.