AD9850 PIC16F Interface

Analog Devices also offers an online calculator for proper word value for each frequency. For AD9850 with 125 MHz oscillator and 8.1Khz output the 32 bit Word in hex is 00043F2A. 00 is Word 1 ,04  – Word 2, 3F – Word 3, 2A – Word 4.What about Word 0 ? At least in the beginning you probably don’t need a Phase change so leave it at 0.The full 40 bit Word looks like this

Word 0 – 0x00 MSB (Send first)
Word 1 – 0x00
Word 2 – 0x04
Word 3 – 0x3F
Word 4 – 0x2A

Attached code does exactly the same sequence as described above producing 8.1 KHz output. See DS2072 scope screen capture.

AD9850 8.1KHz Sine Wave DS2072

Sine wave is shown, however AD9850 also has square wave output with same frequency. Change the 4 Words being sent for other frequencies. Word of advice about square wave output. Square wave is produced by AD9850 module built in comparator. One of the comparator inputs is a potentiometer on the module board, second one is the Sine wave. If you rotate the potentiometer too much it will cause the comparator to produce a constant value “1” or “0”.So if for some reason you get the Sine but Square wave is not working, check the potentiometer. If you are going to power AD9850 module with 5V taken from 7805,LM317 or similar regulators make sure to use a small heat sink. Assembly code can be downloaded here. You may also be interested in a more advanced AD9850 Generator version available here.