EE 476: Laboratory 4
TV Oscilloscope
Introduction.
You will produce a digital oscilloscope which takes one voltage channel input
and displays the resulting voltage trace on the TV. There will be a selectable timebase, a fixed tirgger criterion, an RMS calculation, and an option to lowpass filter the signal.
Procedure:
You will probably want to review the code examples given
in Video Generation with AVR.
Use this example as a basis for your program.
Before compiling, under the Project menu, choose Configure...
, then in the Compiler tab. Set "Optimize for Speed",
reduce the Data Stack size to 100 bytes, and turn off the "char
is unsigned" option.
Build the video DAC shown below and connect it to the yellow connector on the
TV using clip leads and a RCA phone jack. Make sure the TV is set to video input.
Test the TV connection using the example program linked above. The power supplies
on the TVs and development boards are NOT interchangable.
The scope will be AC coupled. Use the following circuit to isolate the signal
source from the DC level required by the ADC. I suggest setting Vref to Vcc for
easy connection to the STK500.
This example shows one way to set up the A/D converter. More information about the ADC converter is available. Because of the sample speed required in this lab, you will have to be sure the ADC prescalar is set appropriately.
Note that timing is very critical for this lab. You will need to write compact code which will fit into the horiziontal sync interrupt. The filtering routines required in the assignment are described on the Fixed Point math page. You will need to convert the ADC output to a fixed point number, filter it, then convert it back to a char.
Assignment
Write a program in C and assembler for the microcontroller with these specifications:
- Produces a video signal. At reset, the program should:
- set the vertical voltage range to 5 volts full scale
- set the time scale to about 8 mSec across the screen and display the
time scale value.
- set the trigger mode to free run and display the trigger mode.
- set the run/stop mode to run.
- turn off the lowpass filter
- Samples an ADC channel at video rate (15.75 kHz) and displays a voltage
trace as 128 dots across the screen. Since the input of the ADC is biased
to 2.5 volts, it would make sense to center 2.5 volts vertically on the screen.
- All parameters should be set by using the 8 buttons on the STK500. You must debounce buttons if it is necessary for relable performance.
- Time base should be settable to approximately 8, 16, 33, 65 mSec across
the screen (128 samples taken every 63.625 microSec is 8.14 mSec).
- Trigger mode should be settable to free run or to trigger when the wave
form passes 0.5 volt above the 2.5 volt bias (3 volts at input to A/D converter)
with positive slope. Free run means that the mcu starts acquireing a new trace as soon as the last one is displayed. In trigger mode, a new trace can start only (1) after the last trace is drawn and (2) the trigger condition is met.
- A digital lowpass filter should be settable to be off or to fliter at 0.1 normalized frequency cutoff. Your grade will partly depend on the number of filter poles you can run in realtime. This means that part of the assembler filter code functions may need to converted to in-line code.
- You should be able to run/stop acqusition. When stopped, the last voltage
trace should be displayed on the TV, along with the RMS voltage. For the RMS calculation, the 2.5 volt bias should be considered zero volts.
- There should be no video artifacts (rolling, tearing, flickering) during
operation. The computation of the RMS voltage will probably have to be spread over several frame times.
When you demonstrate the program to a staff member, you should exercise all
the scope functions and show that the voltage and time scales are accurately
calibrated. One way to do this is to simultaneously display the output of the
signal generator on your scope and on the Tek scope.
Your written lab report should include:
- The scheme you used to coordinate video and the ADC.
- The scheme you used to decode commands.
- An image from the TV.
- A schematic of the curcuit you built.
- A heavily commented listing of your code.
Copyright Cornell University Dec 2006