DDS Theory of Operation

Most modern function generators use Direct Digital Synthesis (DDS) for generating their output waveforms. Older generators used analog methods, which greatly increased the part count (component count) and made them sensitive to component aging and thermal drift. This section describes how DDS technology works. We ignore the implementation details and just look at the principles.

There are two fundamental ideas of DDS technology:

  1. Generating an arbitrary periodic waveform from a periodic ramp signal.
  2. Generating a digital ramp.

Let's first look at generating an arbitrary periodic waveform from a periodic ramp signal. In the following, to keep things simple, we will only use times t 0.

We will call the repetitive ramp function R(t):


This ramp R(t) varies linearly between 0 and 1 with period T. Now, suppose we have any arbitrary function f(ξ) that is defined on the interval 0 ξ < 1. In mathematical terminology, the domain of the function is the half-closed interval [0, 1). Here's a graph of what f(ξ) might look like:


Suppose we want to generate a periodic waveform of period T with the shape of the function f(ξ). Here's the key idea:

To construct a periodic waveform of period T with shape f(ξ), r eplace the ramp's value R(t) at time t with the value of f(t/T - int(t/T)), where int means 'take the integer value'.

Note that t/T - int(t/T) winds up being a number in the interval [0, 1) -- i.e., within the domain of f(ξ).

This is such a simple and useful idea. Let's look at an example. Suppose we want to generate a 1 kHz sine wave. Let f(ξ) be the sine wave sin(2ξ) where 0 ξ < 1. We generate a 1 kHz ramp; it has a period of 1 ms. Here's how we generate the sine wave:

  1. Pick any time t0 0.
  2. Calculate ξ0 = t0/T. This will be a real number; chop off the integer part, leaving a decimal number between 0 and 1.
  3. Replace the ramp value R(t0) with the value sin(2ξ0).
  4. Repeat for all other times.

To proceed to the DDS method, all we have to do now is replace R(t) with a digital ramp r(t). In the following picture, we show two digital ramps. The first one in red has a period of one half of the second one in blue. Both ramps are made with the same digital sampling rate.


Figure 1




The utility of DDS comes from the fact that it is easy to generate digital ramps of different slopes using digital counting techniques. Here's the second fundamental idea of DDS:

To construct a digital ramp, increment a digital counter by on each clock signal.

Now, this statement won't be clear until we explain it. Suppose we have an N bit counter -- this counter counts from 0 to 2N - 1, then rolls over to zero again. Instead of incrementing this counter by 1 on every clock pulse, we increment it by where 1 < 2N. When used with a periodic clock signal with uniform period, this counter generates a digital ramp. Here's a picture that shows what's happening:




Each dot represents a counter value. The counter starts at 0, as indicated by the horizontal red vector. When a clock pulse is received, the counter is incremented by (you may read literature that calls the counter the "phase accumulator"). The counter's value is now shown by the second red vector at about 60°. If you imagine the second red vector is uniformly rotating counterclockwise in steps of , you can see that the rotating vector sweeps out the subsequent points of the ramp. For example, if we imagine that the vector rotated 60° counterclockwise with every clock pulse, then the digital ramp values would be:

0, 60/360, 120/360, 180/360, 240/360, 300/360, 360/360 (i.e., 0), etc. The decimal values are:

0, 0.17, 0.33, 0.50, 0.67, 0.83, 0, 0.17, ...

If you plotted these numbers, you'd see they formed a digital ramp. The digital ramps in Figure 1 iffer in slope because they were made with different values for .

In real DDS implementations, N, the number of bits in the counter, might be 48 -- meaning 2N is a large number, about 2.8×1014. The clock signal is then run at 1 MHz, 50 MHz, 100 MHz or faster. With a 48 bit counter clocked at 100 MHz, you can see the frequency resolution will be 100×106/248 = 3.5×10-7 Hz, or in the Hz range.

DDS is popular because this counting can be implemented in digital hardware that has low parts count (i.e., is simple, which implies better reliability and lower cost) and is fast.

The function f(ξ) is often a sine wave. Because of the symmetry of sinusoidal functions, only one-fourth of the waveform needs to be stored in memory (the portion from 0 to /2 radians). Because of Nyquist's sampling theorem, good sine waves approaching half the clock frequency can be made with a good low-pass filter following the function block. This leads to the rule of thumb that the clock frequency of the DDS generator will be about 2 to 2.5 times the maximum sine wave frequency.

The ramp generator's frequency can be calculated from

which shows that the ramp frequency is a fraction of the clock frequency, as /2N is a number between 0 and 1. Remember that is the counter increment value and N is the number of bits in the counter.

To summarize how a DDS function generator works:

A digital ramp is generated and the desired waveform's shape is substituted for the ramp as discussed above.

Let's look at the basic relationships between sample rate, period, and frequency for a DDS generator's waveform. Let

Then we have the equations

(1)


Advantages and disadvantages of DDS

Advantages:

  1. The frequency is tunable with sub-Hertz resolution.
  2. The phase is digitally adjustable.
  3. Conceptually simple design and low parts count (these help keep cost down).
  4. No drift due to temperature changes or aging of components (as long as the clock is stable).
  5. Addition of arbitrary waveform generation is not conceptually difficult.

Disadvantages

  1. Output frequency is 1/2 the clock frequency.
  2. Amplitude is fixed; need external circuitry to change.
  3. Sine wave is sampled and not spectrally pure; distortion is present.

With careful design, these disadvantages can be minimized.

DDS generator capabilities

A DDS generator's frequency is usually specified as the maximum sine wave output frequency. This is because the sine waves can be generated at nearly half the clock frequency. Generating a square wave from a sine wave is conceptually easy: a comparator outputs a "1" when the sine wave's amplitude is greater than 0 and a "-1" when the sine wave's amplitude is less than 0. However, maintaining the fidelity of a square wave is harder because of the rich harmonic content -- the post-processing circuitry (e.g., amplitude adjustment) needs to be of a higher bandwidth than for a single sine wave. Thus, it is not uncommon to see the square wave maximum frequency to be half or less of the sine wave maximum frequency. A similar comment applies for pulse generation, where the spectral requirements can be even more demanding.

Some function generators provide specialized waveforms as added features. These are additional functions f(ξ) that are stored in the generators read-only memory (ROM). They can be useful for specialized tasks. For example, a circuit designer working on a power supply filter can test with a full-wave rectified sine wave signal without needing a transformer and rectifier circuit. A geophysical researcher can input a low-level earthquake signal into a seismometer's circuit to test the system's response. A medical researcher can use the generator's cardiac signal as input to a circuit used for cardiac monitoring.

Since these specialized waveforms need to be generated accurately, their maximum output frequency will often be much less than the typical sine and square wave frequencies available from the generator.

Arbitrary waveform generation

With the counter and the function f(ξ) to turn the ramp into a desired waveform, it's not a large conceptual step to let the user define the function f(ξ). This results in an arbitrary waveform generator (AWG), although now the function f(ξ) needs to be stored in non-volatile writable memory rather than ROM.

 

Figure 2

Using the above formulas, we can generate the following graph for the relationships between the number of samples in the waveform, the sampling rate, and the maximum waveform frequency an arbitrary waveform generator can output:

You can use this graph to relate how much temporal "detail" you can put into an arbitrary waveform and the highest frequency the generator will be able to repetitively output the waveform. As an example, with a 100 MSa/s sampling rate, 100 kHz is the fastest you'll be able to play back a waveform with 1000 points in it.

Some digital electronics users also use the term AWG to refer to a device that can output arbitrary streams of digital information. Another name for these devices is pattern generator. However, a pattern generator is typically used in conjunction with a logic analyzer. A pattern generator may output digital information over 8, 16, or more parallel digital lines at once. They are often used in applying a known sequence of digital words to a digital system.

The ability to define and generate custom waveforms is so useful that we will take a closer look at a typical arbitrary waveform generator (AWG) and some of its features in the next section.