EE 476: Laboratory 1

Stop watch.

Introduction.

In this assignment you will build a stopwatch. The stopwatch will have a start/stop function and a split function. The split function will copy the current measured interval to the LCD display while leaving the main interval timer (and display) running.

Procedure:

  1. Make sure the evaluation board is connected to power and to the PC as specified in the evaluation board description. Turn on the power supply with the switch on the board. An LED in the middle of the board should cycle from red to yellow to green. For this first lab, there should be jumpers on the PortB to the LED header and on PortD to the switch header. Ask your instructor for help if these are not installed.

  2. After you define a new project, you can add a C source file and edit it.
    1. Save this code (from the Program Organization page) into your directory. This program blinks LEDs and responds to buttons. It is organized as three task subroutines. You will modify this code in the assignment below.
    2. In the Codevision file menu choose to make a new file. When the prompt comes up, choose Project. When asked if you wish to use CodeWizard, decline the offer. At this point, you have made a new project, now you need to configure it. The configure dialog should be open but if it is not, under the Project menu, choose Configure...
    3. In this dialog box, in the Files tab, add the source code to the project you just defined.
    4. In the Compiler tab, set the Chip type to Mega32.
      Set clock speed to 16 MHz.
      Set (s)printf features to int,width.
    5. In the After make tab, set the Program the Chip checkbox.
      Set CKSEL0 and CKSEL2.These select the clock source.
      You may need to uncheck the Check Signature box.
      Then close the configure dialog.
    6. Click on the compile icon. A message window will open to tell you if there are errors in the code. If there are errors, The open the listing file to see where they are. If the compile is successful, you should be able to download the program to the STK500 board and see some blinking LEDs.
  3. You will need to generate a time base for measuring times. I suggest that you use the multiple task timing scheme from this code.
  4. Remember that a switch which is pushed reads back a logic zero. One button will need to be debounced. The spilt and reset buttons don't need to be debounced, but the start/stop button will need it, otherwise button bounces will make the stopwatch unreliable.
  5. The Liquid Crystal Display (LCD):

    A 16 character, two line (16x2), LCD display will be used as a numerical display. The display we are using has an industry-standard interface. A more detailed data sheet for a similar display shows the command set. There are several aspects of the display you should note:


Assignment

Be prepared to demo the program you wrote to your TA in lab.

Your written lab report should include:


Copyright Cornell University Oct 2005