AVR Scope Clock FuncGen



Several years ago, Jesper Hansen published a design for an AVR based mini-DDS generator. This project uses an AVR microcontroller and a simple resistor based DAC to generate various waveforms (sine, sawtooth, triangle, square) using a DDS software technique. Jesper also published a small Windows based program to control the generator, for example to change the frequency or waveform. Take a look at Jesper's project.



Since the Dutchtronix AVR Oscilloscope Clock hardware is well suited for this application, I ported it. It is now included as one of the standard applications in firmware since V3.5.


The Dutchtronix AVR hardware uses a separate DAC IC, not a set of resistors. This results in very precise dots, good when creating a sharp image like the Clock, but not so good for this Function Generator. As a result, the waveforms are more "blocky". Use of the DAC also takes more CPU cycles to do one step through the DDS generation.


Firmware V4.0 and above includes an optimization that shaves one cycle from the each DDS generation step; it now takes 12 CPU cycles. As a result, the "Synthesizer Frequency" in V4.0 and up is 1666666 while the "Synthesizer Frequency" in version V3.6 is 1538461.


Note: check the firmware version you are running by doing a short S1 or a short S2 push; this will display the version number above the menu and/or Help screen. Use a long S2 push to reboot the clock to quickly exit the menu.


Finally, due to the tight DDS generation loop, it is not possible to poll the on-board tactile switches for user input. Only the serial input can be used since it can generate an interrupt. Therefore the AVR Clock needs to be connected to a Windows computer where you can use the ddscontrol program. Connect the AVR Clock to the PC using a standard Serial Cable.


Please remember that this is a design from Jesper Hansen and he is the owner of all the rights to this project.




Make sure the baudrate of the serial port to be used on the PC matches the baudrate on the Dutchtronix AVR Oscilloscope Clock. You must change the PC baudrate (default is 9600 baud) using the Control Panel: System - Device Manager - Ports - Port Settings. The DDS Control program cannot change the baudrate itself.


Start the downloaded ddscontrol program. Right click the title bar to configure it.



Configuration for firmware V4.0



Set the DDS Resolution to 24 bit, set the Synthesizer Frequency to 1666666 (20,000,000/12) (use 1538461 (20,000,000/13) for firmware V3.6)  and select the actual Comport being used.


Next connect a probe or BNC cable to CH1 on the AVR Oscilloscope Clock and your oscilloscope.


On the Dutchtronix AVR Clock, select the Menu (S1 short push), move to the "App" field (S2 short push), select the "Gen" application (S1 short push) and activate it (S2 short push).


You should see a waveform on your oscilloscope. You can change the shape and set the frequency using ddscontrol. Or you can incrementally increase or decrease using the arrows:



Up 1 Hz


Up 100 Hz


Up 10,000 Hz


Down 1Hz


Down 100 Hz


Down 10,000 Hz


It is probably a good idea to test the serial connection if the generator fails to work as expected. The easiest way to do this is to run a terminal program on the computer (Bray's terminal works great) and set the clock in terminal mode. Make sure both sides are set to the same baud rate. If you type in a character on the computer side and send it (this is necessary in Bray's terminal), that character should show up in the terminal window on the scope display. This only tests one way but it's a start. Once that works, you can set the clock back to clock mode and, after making sure that the baud rate is set correctly, type a command like "xs", then send it when using Bray's terminal, and the clock will return status information. This step tests both directions on the serial link.


For unknown reasons, ddscontrol.exe sometimes fails to operate properly. I have found that locating and deleting the file "minidds.ini" in the directory where ddscontrol.exe was started, can fix problems. Since I do not have the source code for ddscontrol.exe, there is no way to know what is happening, but try to delete minidds.ini if you run into problems (but after verifying that the serial connection works properly)


Back to Dutchtronix AVR Oscilloscope Clock


horizontal rule


Back Up