AD9850 PIC16F Interface

A simple wave generator should be a part of every electronics enthusiast toolset. Basic Sine/Square output in reasonable frequency range will be sufficient for general use. Luckily such generators are available in form of a very popular AD9850 module.  Search the web for AD9850 designs/code and  you’ll find a lot of material available on how to build various circuits around this module. Some are relatively complex for beginners and most of the interface software is written in C and not as simple to understand. I could not found an easy parallel interface assembly code for Microchip PIC microcontrollers so I had to construct a simple hardware configuration and write a basic PIC16F compatible code.

AD9850 PIC16F876A Interface Prototype Board

The code was written for PIC16F876A, however it should work on all similar MCU.As you can see in the design schematic 11 I/O are required: 8 bits of PORTC are used as Data and 3 bits of PORTA are controlling the parallel loading W_CLK, FU_UD and Reset of AD9850.Here is the parallel load timing sequence as provided by IC manufacturer Analog Devices.

Full data sheet can be downloaded here. Minimum time delay should not be a problem as PIC port switching time is much slower. Also a big delay was intentionally put in the code, about 0.5 s to give enough time to see signals flow.The delay can be reduced to a minimum if all works well. If you’ve followed the schematic and used the same code you’ll see the following sequence as soon as PIC is released from Reset state:

  1. Line RA2 will reset the AD9850,Reset LED  ON for 0.5s and OFF.
  2. First 8 bit Word out of 5 Words will be sent by PIC to PORTC. Bit RA0 will toggle W_CLK  line to load the Word into AD9850.
  3. Additional 4 parallel loads will be done. After loading 5 words RA1 will toggle FU_UD.

Shortly after you can see an output available on AD9850 representing the 5 words frequency value. Actually only 4 words represent the frequency, first byte in parallel load is Phase and 2 control bits.

AD9850 8-Bit Parallel Load DataControl Word Functional Assignment


Leave a Reply

Your email address will not be published. Required fields are marked *