EE 476: Laboratory 6

Waveform analysis
using an analog-to-digital converter.


You will produce a sine wave using the PWM output of timer1. The frequency will be set from a keyboard. A LCD display will show the peak-to-peak voltage and frequency of the signal determined from analog-to-digital (A/D) converter measurements of the signal. Timer0 will be used as the timebase for the A/D converter.


The PWM output should be lowpass-filtered using an RC circuit with a time constant at least ten times the PWM pulse-time. The A/D input is limited to 0-2.0 volts, while the output of the RC circuit will be centered around Vcc/2. Also, the A/D input impedance is only about 6Kohm. We thus need a circuit to:

  1. Lowpass-filter the PWM output.
  2. Shift the level to 1 volt ±1volt.
  3. Drive the relatively low impedance input of the A/D.
The circuit below shows one way to accomplish the three items above.

The A/D converter input should be connected to the output of the op amp. See the A/D documentation for a schematic.

As in Lab 5, the Keyboard:
You will need to get user input from a keypad with the following configuration.

Pin 1  -- row 1 2 3 A
Pin 2  -- row 4 5 6 B
Pin 3  -- row 7 8 9 C
Pin 4  -- row * 0 # D

Pin 5  -- col 1 4 7 *
Pin 6  -- col 2 5 8 0
Pin 7  -- col 3 6 9 #
Pin 8  -- col A B C D

(a) Each switch shorts one row to one column.
(b) Each pin should be connected to one 
    bit of an i/o port.
(c) The i/o port pins will be used both 
    as inputs and outputs. When they are inputs, 
    they should have the pullup resistors
As in lab 5, the Liquid Crystal Display (LCD):
A 16 character, one line (16x1), LCD display will be the output for your capacitance meter. The display we are using has an industry-standard interface. A data sheet for a similar display shows the connections. There are several aspects of the display you should note:

Write a program which will:

When you demonstrate the program to a staff member, you should exercise the keyboard commands and show that the measurement displayed on the LCD is correct. The TA will probably supply a waveform for you to analysis.

Your written lab report should include:

Jan 1999 Copyright Cornell University