AD9833 (Programmable Waveform Generator)1 controller using AVR
Introduction
These are so many projects to use AD9833. This is one of such project. Compared to other projects, this is much smaller and much cheaper, because I used an AVR (instead of Arduino etc.). You control the AD9833 via a serial interface. This is both an advantage and a disadvantage. At least it is a great benefit for people like me—who want to do almost everything on a terminal. Of course I know: such people are in the minority ;-)
If you are looking for a standalone controller, see for example:
-
DIY Function/Waveform Generator by GreatScottLab
-
How to Build Your Own Function Generator Using Analog Devices' AD9833 by Cezar Chirila
(and many other projects.)
Requirements
-
AD9833 board (see photo)
-
AVR with 4 KB or more flash.
-
USB-Serial board
Tested AVRs
-
ATtiny85
-
ATmega8
-
ATmega328P
How to compile
-
edit
config.h -
edit
Makefile(in particular the device name and the writer settings) -
make -
make flash
How to use
You can control AD9833 via a serial console.
Try h or ? to see help messages (if you compiled the program with USE_HELP).
Basic commands
All commands are case insensitive.
- [number]
-
frequency (in Hz). To specify a frequency, you can use the following notations:
-
100
-
10k
-
1.5k
-
1k5 (= 1.5k)
-
2M
-
-
S -
sine wave
-
T -
triangle wave
-
Q -
square wave
-
RESET -
send reset to AD9833
-
H,? -
show help message
EEPROM (need to compile with USE_EEPROM)
-
SAVE -
save current registers to EEPROM. AVR loads the saved values at reset (if saved data in EEPROM exists). In other words, once you save the registers, you don't need to connect the USB-serial board as long as you use the AD9833 at the frequency and waveform.
-
LOAD -
load the saved values.
-
ERASE -
erase the saved values.
Example
$ dterm /dev/ttyUSB0 4800
AD9833 CONTROLLER VERSION 1.0
h # <--- help
Usage (case insensitive):
[freq]: set frequency
e.g.: 100 10k 1.5k 1k5 (= 1.5k) 2M
S: sine wave
T: triangle wave
Q: square wave
RESET: send reset to AD9833
SAVE: save current registers
LOAD: restore saved registers
ERASE: erase saved registers
H, ?: help
t # <--- select a triangle wave
25k # <--- set frequency (25 kHz)
Example: output of AD9833 (triangle wave, 25 kHz)
Analog Devices: AD9833 Datasheet and Product Info
