Stand-Alone DDS Unit
changed my design to use it instead.
The DDS can generate any frequency up to one half the main clock
(Fosc) in steps of Fosc/228. This is
because the DDS uses a 28 bit phase
accumulator. With the 25 MHz oscillator, this yields steps of about 0.1 Hz.
The highest practical sine wave output
is about 1 MHz. Higher frequency signals do not look much like sine waves.
offset resistors. An option which may be
of interest is to make the maximum
output voltage 0 dBm. When driving
600 ohms, 0 dBm is 0.7746 volts. This is
equivalent to about 2.19 volts peak-to-peak, which is very close to the output
voltage of my circuit. By reducing the
gain to a factor of 3. 65 (instead of 5),
you will get a maximum output voltage
of 0 dBm. You might also then want to
change the output resistor (R11) from
200 ohms to 600 ohms, so you have a
600 ohm output impedance.
— FSER.LIB — for the SPI communications. You will find that the source files
(available on the Nuts & Volts website
at www.nutsvolts.com) are fairly well
commented and should be relatively
easy to follow. Most of the code is
in C but there are some functions
partially in Assembly language.
The Attenuator Board
My initial design did not have any
means to control the amplitude of the
output signal. I decided to implement
an amplitude control circuit after
showing my prototype to a few
friends at work (Figure 4). The circuit
consists of three sections: an inverting
amplifier to get the signal up to a higher level, a programmable attenuator,
and a voltage follower.
The inverting amplifier has a gain of
approximately five — fixed by the ratio
of R8/R7. Since the signal is applied to
the inverting input, I had to add an offset circuit — R9 and R10 — to insure that
the output signal stays in the linear
range of the op-amp. With these component values, the output voltage
ranges from about one volt to four volts.
To keep the design simple, I decided to
not implement any kind of adjustments.
The attenuator consists of a programmable
potentiometer and voltage
follower. The AD5200 is
programmable in 256 S3
equal steps with an end-to- 7
end resistance of 10K. The 6 5
program allows you to set 4
the “wiper” to any of the 2
256 positions. This yields a 1
step size of 3V/256, or
approximately 12 mV. It
would be fairly easy to modify the program to allow
you to program in dB or millivolts. By changing the ratio
of the gain resistors, you
can easily change the maximum peak-to-peak voltage.
If you change the gain, you
will need to change the
value of at least one of the
I have been using SPI devices for
many years, but still managed to overlook a very important “feature” of SPI.
There are four modes of SPI which
define various phase relationships
between the clock and data signals.
As it turns out, the DDS uses one
mode and the attenuator IC uses a different mode. At first, I did not realize
this — mainly due to not reading the
specs carefully enough. The program
now changes the SPI mode when
entering the attenuator function and
then restores it to the mode required
by the DDS when exiting.
The main parts of program are
contained in two files: AD9834.C and
AD9834.LIB. I also use a serial library
When not changing a parameter
via the menu, the display will show
the current frequency and phase values, as well as indicating the current
mode and waveform. There are not
enough characters in the display I
used to also display the amplitude.
The menu system uses a two line,
16 character-per-line LCD and two
push button switches. I found this to be
adequate for my needs and it does
allow you to easily set up the unit.
Following is a brief description of the
menu and how to navigate it. The main
menu consists of the following options:
1. F0 — Change Frequency 0
2. F1 — Change Frequency 1
3. P0 — Change Phase 0
4. P1 — Change Phase 1
6. Mode of Operation
W IC7.2 AD8529 R11 200
■ FIGURE 4
November 2006 51