AVR DDS signal generator V2.0 Part 2. Firmware
AVR DDS 2.0 Firmware
As I have mentioned DDS function is a modified Jesper’s DDS algorithm. Main modification is adding additional ASM line which enables to stop DDS generation. In version 1.0 the only option was to reset device, dds function checks if CPHA bit is set in SPCR register which is set during external interrupt service routine (stop button). So now algorithm takes 10 CPU cycles instead 9.
DDS Signal tables has to be placed in flash sections where address starts with 0xXX00. So these sections has to be defined in makefile for proper memory placement:
LCD control library is described here.
LCD menu control
All actions can be viewed in LCD menu. Menu can be controlled with 5 buttons that are next to LCD module
Up and down arrow buttons are used for browsing menu while right and left arrow buttons are used for changing frequency value. When middle button is pressed – signal generating starts. Press middle button again to stop signal generator.
Here is a complete menu system of signal generator:
Important to notice, that there is a separate menu for changing frequency step. This is convenient if you need to change generator frequencies in wide range. This allows to set any frequency with relatively few button clicks.
Noise generation don’t have frequency setting. It uses simple rand() function where results are continuously output to DDS output.
High speed signal has four frequencies available: 1, 2, 4 and 8MHz.
Testing and discussion
I have tested signal generator with oscilloscope and frequency counter. Signals look like expected in all frequency range [1 to 65535Hz]. Amplitude and offset regulator works OK. If offset is set to 5V, then maximum clear signal amplitude may be 5V as another 5V is already used for offset(same is if offset is -5V).
Here are few test signals on oscilloscope screen:
Source code and hex – download
News on theme: