EE 476: Laboratory 1

Reaction Time Tester.

Introduction.

This assignment introduces you to the software and hardware development tools you will use this semester to work with the Atmel AT90-series microcontroller (MCU) chips. You will use the STK500 development board to build a human reaction time tester. The STK500 pushbuttons, an external LCD, and the mcu will be used to see how fast you can push a button after a light flashes.

Hardware

The hardware you will be using to support the AT90-series is the Flash MCU evaluation board, a small board providing:

A small power supply provides power to the development board. The demo codes given in this lab are written for the MEGA32, but many of the examples throughout the 476 web site are written for the 8515 or MEGA163 mcus. This year we are using the MEGA32 which has more memory. To run the 8515 or MEGA163example programs you will need to:

The Liquid Crystal Display (LCD):

A 16 character, two line (16x2), LCD display 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:

Software

Software you will use consists of:


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. Make a subdirectory for your group in the My Documents folder. Name it with your netid.
    Be sure to put all your files there and to back up daily!.

  3. There should be a shortcut to Codevision C on the desktop.

  4. 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. Under the Project menu, choose Configure... , then in the Files tab, add the source code to the project you just defined.
    3. In the Compiler tab, set the Chip type to Mega32.
      Also set (s)printf features to int,width.
    4. 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.
    5. 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.
  5. Connect the LCD and run the LCD test program. You should see a counter and a moving dot.
  6. You will need to generate a time base for measuring reaction times. Most people have a reaction time in the range of 100 mSec to 200 mSec, but this can be quite variable, up to several hundred mSec.I suggest that you use the multiple task timing scheme from this code.

  7. Remember that a switch which is pushed reads back a logic zero.


Assignment

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

Your written lab report should include:


Copyright Cornell University Jan 2004