A sine wave generator using AD9833 and AD9850 using STM32F103RB

Dependencies:   mbed

This is a sine wave generator using DDS IC' AD9833 and AD9850. The STM32F1 microcontroller produces the SPI commands for the two DDS.

Learn more about STM32F1 in my blog: https://www.teachmemicro.com

Revision:
3:f7923b9e8611
Parent:
1:9dcccb399f0b
diff -r 602f7589c53e -r f7923b9e8611 main.cpp
--- a/main.cpp	Tue Nov 21 19:18:25 2017 +0000
+++ b/main.cpp	Tue Nov 21 19:57:07 2017 +0000
@@ -13,7 +13,8 @@
 double DDStrimFreq = 124999500;    //frequency used by AD9850 to calibrate
 int DDSphase = 0;                  //phase for the AD9850
 
-Thread thread;                   //create thread to allow simultaneous LED blink and DDS output
+Thread GENthread;                   //create thread to allow simultaneous LED blink and DDS output
+Thread LEDthread; 
 
 //AD9833 LED thread
 void GENBlinkThread() {
@@ -37,8 +38,8 @@
 
 int main() { 
 
-    thread.start(callback(GENBlinkThread));
-    thread.start(callback(DDSBlinkThread));
+    GENthread.start(callback(GENBlinkThread));
+    LEDthread.start(callback(DDSBlinkThread));
    
     // Sequence to follow to generate waveform using AD9833
     gen.Begin();              // The loaded defaults are 1000 Hz SINE_WAVE using REG0
@@ -54,5 +55,7 @@
     dds.CalibrateDDS(DDStrimFreq);       //calibrate to match crystal oscillator
     dds.SetDDSFrequency(DDSfreq, DDSphase);
     
+    GENthread.join();                   //wait for the threads to finish
+    LEDthread.join();
     while(1);
 }