Bascom and AVR, a simple AD9951 DDS controller


The Analog Devices series of AD995x DDS's is proving to be very popular amongst radio-amateur homebrewers. This DDS family is a lot cleaner and runs much cooler than the AD985x. They are cleaner because of the 14-bit DAC and they run cooler because the core runs on 1.8V.
The AD995x has a maximum clock frequency specification of 400MHz, but I have had it run as fast as 750MHz, so overclocking to 500MHz should not be a problem.
Several designs have appeared, most of them using a PIC processor or using a PC as controller. I needed a simple controller using an Atmel AVR. I used an ATMega8 which proved to be only just large enough. This is because of the floating-point calculations used in the determination of the DDS tuning word.
The controller uses eight push-buttons:
two buttons for stepping the DDS frequency up/down
two buttons for increasing/decreasing the frequency step cursor
one button for cycling through ten frequency memories
one button for storing a frequency in the selected memory location
one button for recalling a frequency from the selected memory location
one menu button for changing DDS clock multiplier and DDS clock frequency

The controller and the DDS are built into a small metal box. The front has a PLED 16x2 display and seven push-buttons (the menu button is inside the box):


The inside of the box shows a small veroboard with the controller, and a seperate box made from PCB material with the DDS and clock PCB's. These small PCB's are from Giuliano, I0CG . In the picture, the DDS still runs on a 50MHz crystal oscillator, the 500MHz clock is not connected yet:


The schematic is quite simple: it has the ATMega8, the display and the push-buttons. (the push-buttons were originally attached to a PCF8574 I2C i/o expander, later they moved to the ATMega PortD directly, that is why there is an empty 16-pin socket on the veroboard)


The program is a little more complicated than the controller schematic. The main difficulty is that Bascom does not have an unsigned long or even unsigned longlong (64 bit) type. So, the calculation of the DDS frequency tuning word is rather clumsily done so as not to lose too much accuracy while using the available data types. The program source has some comments to explain its workings.
When the program starts up, PortD is tested to seen if any of the buttons is pressed. If that is the case, default frequencies are stored in the ten memory locations. Also, a default clockfrequency of 50MHz and a clock multiplier of 1 is assumed. This can be changed using the menu button. If this button is pressed, the multiplier can be changed from 1 to 4-20. After that, the actual clock frequency can be set.

TOC