Digital Frequency Generator

by Martin Clausen (mc AT rotgradpsi DOT de)

Signal generator with DDS technology: 32 bit adder, 16 MHz, 16 bit DAC, AM & FM, MCU control, software adjustable via RS232

Table of contents:


Principle of Operation

User Interface

The circuit is controlled by a MCU. It is accompanied by a LCD, knobs, RS232 interface and an EEPROM. LCD and knobs allow a precise and user friendly frequency, amplitude and offset control.
The RS232 interface is necessary for adjustment and remote control of the frequency generator. The communication protocol allows direct control of the values of the shift register and DACs but also the transmission of frequency and voltage values in Hz and volt respectively. Direct control of the registers is faster, but the user have to calculate the values from the desired frequency and voltages on his own. The EEPROM stores power-up and calibration values.

Digital Frequency Generation

The digital part of the frequency generator consists of a shift register, an adder, a latch and a 1M bit EPROM. The shift register reduces the need of port pins at the MCU from 33 to 3. It also synchronises the data input from the MCU with the operation of the adder.
The adder output is feedback to itself via the latch. Therefore the value at the output of the latch is increased by the value in the shift register at every clock cycle. This value is also taken as an address for the EPROM. This EPROM contains a table, which allows to convert the value from the latch into the amplitude of the output signal. In principle any waveform can be stored and therefore generated.
The accuracy of the generated frequency is determed at low frequencies by the precision of the oscillator and at high frequencies by the jitter, which is caused by the discrete nature of adder and table.
The frequency and amplitude modulation is based on a DDS software in the microcontroller. Since the sinus is read from a 16K byte lookup table (LSB first) starting at &H01000, you can replace it by any other waveform.

Analog Processing of the Signal

The final output signal is formed through DAC, filter, multiplier and an amplifier. The digital output of the EPROM is converted to a analog signal by a high speed, high precision DAC. Its current output is converted to a voltage by a operational amplifier. To remove glitches and harmonics a Butterworth filter is employed.
The MCU shifts the amplitude value into the DAC. The output of the DAC is feed into the multiplier and allows the adjustment of the amplitude. The offset is adjusted by another DAC. Its output is converted to a bipolar output by a dual OP. In the final step the signal is amplified by a strong operational amplifier.


You can get most parts at Elpro, Germany only sepcial parts are listed.

Possible Causes of Errors

Direction of Further Development

Those ideas lead to the following design:
Your help is welcome.

Download of Program and Circuit

To allow you to customise you frequency generator fully to your needs, FGSimple is released. It is similar to FG, but does not support AM & FM, amplitude and offset control and employs only a 1*16 LCD to save costs. If you need only the digital output at low frequencies, you may also leave away EPROM, DAC, filter and output stage.

The part description in schematics is read as follows:
part type + value in exponential form + package description + subpart number in package
for example: C1040805,1 means Capacitor, 100nF, package SMD 0805, first subpart in package

The exe and ini file are expected to be placed in the same folder!

Similar Projects

DescriptionWhom's work
slower, cheap, low part count, PC controlled, AVR projectJesper Hansen

Disclaimer: No warranty at all!
Copyright by Martin Clausen, Germany.
Contact the author: mc AT rotgradpsi DOT de