EE 476: Laboratory 2
You will produce a sinewave generator which is controlled from a LCD pushbutton
interface. The sinewave generator frequency will be set by increment/decrement
commands on the buttons. The program will display the frequency on the LCD.
You will need to build a simple digital-to-analog converter as shown below.
You may want to code part of your program in assembler. The program
organization page has an example of squarewave synthesis in C
The same program is recoded using a mixture
of C and ASM. There is an (all C) example of DDS synthesis.
Write a program and build a circuit which will:
- Generate sinewaves using DDS. The sinewaves should be built from 8-bit samples
(taken from a 256 entry table) and converted to a voltage with a DAC. Note
that you will need to use some assembly language to get maximum speed.
- Use a button on the STK500 to start/stop the sinewave. You will need to
debounce the button.
- When started, produce a sinewave from the DAC.
- When stopped, allow the user to set a new frequency by using two buttons
to increment/decrement the frequency displayed on the LCD. You can set the
increment to a fairly large value, say 100 Hz, but the frequency accuracy
at every frequency must be better than 1%.
- Code the program to produce as high-frequency a sinewave as possible. There
must be at least 16 samples per sinewave cycle.
When you demonstrate the program to a staff member, you should exercise the
commands and show that the generated frequency is correct to within 1%. You
will be competing against every one else in the class for speed. Your maximum
frequency will need to be in the upper third of the class to get full credit.
The TA must write down your maximum frequency, or it does not count.
Your written lab report should include:
- A heavily commented listing of your code.
- A schematic of your circuit.
- A waveform captured from the oscilloscope showing the waveform you generated.
You can use your digital camera if you wish.
Copyright Cornell University Jan 2004