ECE 4760: Laboratory 3
TV Digital 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 trigger level and slope, run/stop, and a frequency calculation.
-- A video example of what you should see with input from a signal generator.
-- Note that timing is very critical for this lab. You will need to write compact sample and trigger code which will fit into the horiziontal sync interrupt.
-- Part of the grade for this exercise requires that you figure out how to insert samples 32 microseconds apart into
each video line
and optimize voltage trace refresh speed
on screen.
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. You must uncomment the multfix
routine or put multASM.S in the project source.
Build the video DAC shown below and connect it to the yellow connector on the LCD
TV using clip leads and a RCA phone jack.
Note that you should remove the jumpers connecting D0 and D1 to the USB chip, circled below.
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.
Because of the sample speed required in this lab, you will have to be sure the ADC prescalar is set to 1 MHz.
Assignment
Write a program in C and (possibly) 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 10 mSec across the screen width (sample rate of 15720/sec) 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.
- Samples an ADC channel at video rate (15.72 kHz) or faster and displays a voltage
trace as about 160 dots across the screen.
Note that to get full credit you will need to sample at least twice as fast (31440 Hz) with uniformly spaced samples.
Maximum sample rate
is aournd 70,000/sec at 1 MHz ADC prescalar.
This video is running at 62880 samples/sec. Another version of the with the ISR pixel blaster code unrolled allows trigger detection on every sample.
Since the AC-coupled input of the ADC is biased
to 2.5 volts, it would make sense to center 2.5 volts vertically on the screen.
- Display the estimated frequency of the displayed waveform at all times, similar to what is shown on the video above.
- Increments a timer/counter and display the interval between screen refreshes.
Note
that part of your grade is determined by how fast you can refresh the voltage trace and frequency readout on screen.
15 to 30 refreshes/sec will get you full credit.
- Set all parameters by using buttons on the keypad, or on a white board.
You must debounce buttons if it is necessary for relable performance.
Parameters (run/stop, trigger/free, and time scale value
) should be displayed on screen.
- Set time base to approximately 5, 10, 20 mSec across
the screen (160 samples taken every 63.625 microSec is 10.2 mSec).
- Trigger mode should be settable to free run or to trigger (with one button) when the input voltage passes the 2.5 volt bias level
with positive slope.
Free run means that the mcu starts acquiring a new trace as soon as the last one is displayed.
In trigger mode, a new trace can start only when: (1) after the last trace is drawn and (2) the trigger condition is met.
- You should be able to run/stop acqusition with one button and display the run/stop status on the screen..
When stopped, the last voltage
trace and its frequency should be displayed on the TV.
- There should be no video artifacts (rolling, tearing, flickering) during
operation.
When you demonstrate the program to a staff member, you should exercise all
the scope functions and show that the 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 program should not need to be reset during the demo.
Your written lab report should include the sections mentioned in the policy page, and :
- The scheme you used to coordinate video and the ADC.
- The scheme you used to decode pushbutton commands.
- An image from the TV.
- How you measured the frequency.
- A heavily commented listing of your code.
Copyright Cornell University
September 11, 2012