EE 476: Laboratory 5

Digital Capacitance Meter
with keyboard and display.


You will produce a digital capacitance meter (DCM) which is controlled by a keyboard and which shows the capacitance on a LCD display. The DCM will measure capacitances from 1 nf to 100 µfarad in several ranges. The ranges will be controlled from the keyboard.

Note that you will be using the AT90S4414, for this lab. Read the AT90S4414 data sheet.


Your program will have to:

  1. Measure the capacitance (as in Lab 4).
  2. Format the capacitance as a string.
  3. Poll a keyboard for keystrokes.
  4. Write the results to a LCD.
As in lab exercise 4, the approach we will use is to measure the time for a RC circuit to charge to a given level. The requirement for a large capacitance range in the measurement means that you will have to modify the circuit from Lab 4 (also shown below), or perhaps the software, to keep the time-measuring counter from over/under flowing. There are at least two ways to do this: You will have to choose a scheme.

The Keyboard:

You will need to get user input from a keypad with the following configuration. Demonstration keyboard scanning code is here.

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
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 capcitance displayed on the LCD is correct.

Your written lab report should include:

Jan 1999 Copyright Cornell University