HOME

Lab components

Objective

Reading

Links

Part1

Turnin

CSE 477: Embedded System Design
(Spring 2002)
Lab 1: 
Introduction to Microcontrollers
(Part I)

Objectives:

This lab will require you to: 

  • Learn to use Keil Environment
    • Build a project in Keil
    • Write a simple C program
    • Compile (build) a Keil project
    • Use the the debugger to run and debug a program

Getting Started

There are some on-line tutorials that are a pretty good introduction to using the Keil environment.  Find the CD folder in the Keil folder and run the SETUP.EXE program.  This will give you a menu - you want the "Tutorials and Training" option.  The three tutorials, "Creating Projects", "Testing and Debugging" and "Advanced Simulation" are all worthwhile (just ignore the market-speak).

There are also Keil manuals in the lab, the on-line Help from within Keil, and the following links:

Your First Program

Here is about the simplest program you can imagine.  Start a project, type in this program (or cut and paste) and then use the debugger to step through the program, watching the registers and the output port P0.  When you make your project, use the SMALL code size and SMALL data size.



#pragma code

#include <reg51.h>

void main() {
  char i;

  while (1) {     
    for (i = 0; i < 100; i++) {
      P0 = i;
    }
  }
}



Your Second Program

Once we get to running this program on the microcontroller, we are going to connect the port P0 to one of the 7-segment displays.  Write a program that turns on one segment at a time, rotating the segment in a circle using the outside 6 segments.  For now don't worry that the segments will rotate too fast - we'll fix that later.

What to Turnin

Turn in your C program that rotates the 7-segment display LEDs.
Demonstrate that your program works using the Keil debugger and have us sign off on the C programs.
 

 BACK TO TOP

 Last Updated:
3/24/2002

Contact the instructor at:cse477-webmaster@u.washington.edu