HOME

Lab components

Objective

Getting Started

Turnin

CSE 477: Embedded System Design
(Spring 2002)
Lab 2: 
Introduction to Microcontrollers
(Part II)

Objectives:

This lab will require you to: 

  • Learn to use the DW8051 embedded core
    • Include the DW8051 in a Foundation project
    • Compile a C program into ROM
    • Use Foundation to simulate the DW8051
    • Understand how to interface to the DW8051
    • Synthesize your project to the XSV-300 board
    • Add an external port interface to drive the 7-segment displays

Getting Started

In this lab you will start with a simple Foundation project that includes a complete 8051 implementation.  This project has been archived in the class directory (ifilesrv1\courses\cse477\Spring2002) as Lab2.  Load up this project and bring up the schematic.

Take a look at how the DW8051has been connected to iram and irom.  Note the inverter on the clock.

Poke into the irom to see the VHDL program that implements the ROM.  The ROM contains the simple program that you used in Lab 1.  The VHDL program for the ROM was generated from the HEX file produced by the Keil compiler using the program  i8081_mkr.exe  Note that this program generates a large ROM - this can be cut down to size simply by changing the number of address bits of the ROM.

Simulation

Bring up the simulator and go to the Script Editor (under Tools) to bring up the test script (TEST8051.CMD).  This is a pretty good example of a test script.  To find out more, check out the Macro Assistant under Tools, or use the online Help.

Run the simulation (this will take a few minutes) and then spend some time looking at the simulation results.  You should single-step the program in the Keil debugger as you go through the waveform to help make sense of things.

Making an Interesting Program

Before we synthesize the project to the XSV-300 board, we need to make it do something interesting.  There are two 7-segment displays on the board.  Add an interface from the DW8051 to these displays via the SFR bus.  It's probably easiest to use P0 and P1 ports, but you should experiment with other (ununsed) SFR addresses.  Your interface will consist of a register along with the appropriate decoding logic.

Now write a program that counts from 1-99 using the display, adding some loops so that it counts at about 1/10th of a second.

Before you synthesize, simulate!  Make a new ROM with your program and make sure it behaves correctly under simulation, that is, the pins are driven correctly.  Since the outer loops will take forever, you can compile a program with smaller loops, or "patch" your VHDL ROM program to put in smaller values temporarily.  (Copy your original VHDL program first so you can substitute it back.)

You should now be able to implement your design and generate a bit file to download to the XSV-300 board.  The project already contains a constraints file which you should not have to edit.

Before you push the Implement button, uncheck the "Trim Unconnected Logic" box under the Implementation / Optimize and Map Options.  Otherwise, the synthesis tools will try to throw away stuff that is needed later.

Download your program and try it out.  Remember, it probably won't work unless the clock is less than 15MHz.


To Turn In

Demo your simulation.
Demo your working project.

 BACK TO TOP

 Last Updated:
3/24/2002

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