Hi,
I noticed that your code became lengthy because in every function, you set reset and exit reset.
I suggest, you do this only once and put it in your main function.
just to check if your spi write is good, I suggest you try resetting first: 0x0100. You should have a midscale output (~330mV)
If you get that, then you may proceed with the addition of other functions.
here are my suggestions on your code.
#include
#define
static void ad9833_word()
//remove ad9833_write function
void AD9833_setFreq()
//remove reset bit cycle here
AD9833_word(x0400+14-bit LSBs);
AD9833_word(x0400+14-bit MSBs);
void AD9833_setPhase()
//remove reset bit cycle here
void AD9833_setMode()
//I didn't check the cases but I assume you followed table 15 in datasheet.
void init_SPI1()
main function ()
AD9833_word(0x2100); //DB13=1 and resetbit=1
AD9833_setFreq(frequency);
//you can skip setting phase
AD9833_word(0x2000); //DB13=1 and resetbit=0
Please let me know if that worked.
-Sittie