I'm using C++ and an mbed microcontroller. I'd like to program my AD9850 for an output frequency of 2MHz.
I used the online configuration assistant which gave me the following values for the 40bit programming word.
. The simplest way for me to enter the data as a serial stream is to use pin D7 and my approach is this
I join all the values obtained into one long word and then clock in each bit one at a time. The 40 bit word I use is
but it looks as if the msb is 1 which would make my output frequency much larger than 2 MHz. I think I have concatenated the sub-words incorrectly. What should the order be ? Should each sub-word also be reversed ? Is this a correct way to load the 40 bit word into the device ?
40 load the word into a char array w=1010111011001001000110000010000000000000
60 if(w[i]=1) then
70 write 1 to the D7 pi
80 else write a 0
90 when all bits are loaded update the frequency
I have unpredictable results when using this method and sometimes I can see a nice square/sine wave on my scope and sometimes not. I'm not sure if I should pull the iout (pin20) up or down. My scope has a ceiling of 25 MHz so if I get my word backwards I expect it will be difficult to see a good sine wave. Perhaps I need to filter the output anyway. Also if you try to translate the last 4 sub-words into a frequency it seems not to make 2 MHz so I do not understand the relation between the digital word 32 bit frequency part and the output frequency. The calculation in the datasheet does not seem to correspond with the calculation in the InteractiveDesignTool (http://designtools.analog.com/dt/dds/ad9850.html). Also not sure of control bits in w0-7 in particular what are the power-up power-down bits doing ? Do they turn device on or off after programming ? Finally how does the device know whether serial or parallel programming is used ?Any advice welcome.
My AD9850 is on a module inclulding a 125 MHz crystal clock. Picture included.