HOME

Lab components

Objective

Reading

Links

Part1

Turnin

CSE 477: Embedded System Design
(Spring 1999)
Lab 1: 
Introduction to Microcontrollers

Objectives:

This lab will require you to: 

  • Learn about your XS40 board
    • How does the microcontroller interface with other components?
    • Why do you need to upgrade the microcontroller?
  • Learn about the Keil Environment
    • Load a project in Keil
    • Compile (build) a Keil project and run it on the microcontroller
    • Learn how Keil C interfaces with the microcontroller
  • Upgrade your board for the new microcontroller
    • Wire a switch to reset the microcontroller
    • Wire an LED to verify the reset state
    • Program the flash memory using the Data I/O machine
    • Run the previous programs on the new microcontroller

Reading
This lab has two handouts: 

  • XS40 board pin-out
  • Keil docs -- Chapter 3

Other Relevent Links

Part1--Learning the Keil environment
1. Get XS40 board, plug in parallel cable, plug in the XS40 power supply.
2. Goto \\ifilesvr1\courses\cse477\bin\  (most likely mapped to u:)
3. Run "xstest xs40-010xl".  Watch your led! It should end in a 0.  This verifies that the board is working correctly.  If the test fails, get me.
4. Goto \\ifilesvr1\courses\cse477\lab1\
5. Copy all files to your local network drive (z:).  I'll refer to this directory as "mylab1".
6. Run (from start menu) programs/Keil PK51/uVision-51.
7. Select Project/New Project... from the Keil menu.
8. Select your Z: drive and your "mylab1" directory, and name the project "ledreg.prj".
9. Click the "Add" button and add "ledreg.c".
10. Save the project.
11. Goto file/open and open ledreg.c. 
11. Build the project. Either goto Project/Make build project or bush the shortcut button (three down arrows pointing at a rectangle).  It should say "Make successful. HEX file created."

Part 2--Programming the board
1. Open up a command prompt window.  Goto to your z:mylab1 directory.
2. Type "xsload ledreg.hex ledreg.bit".  This will load the hex file into the memory and the bit file into the FPGA. 
3. Type "xsport 1" followed by "xsport 0".  The FPGA is wired to reset the microcontroller through the parallel interface.  These two commands toggle the low order bit of the 8-bit parallel port, effectively reseting the microcontroller.  Your ledreg program should now be running.
4. Modify ledreg.c to light up the outer led segments (i.e. the segments used in a 0) one at a time in a clockwise pattern. 

Part 3--Upgrading the Microcontroller
1. Unplug the 9V supply and the parallel cable.
2. Remove the microcontroller carefully with the chip puller clips. Make a note of the orientation of the microcontroller.
3. Get a switch and an led light.
4. Install the switch and led according to the diagram below.


 

5. To program the new microcontroller, you will use the DataI/O 2900 programmer.  First copy the hex file from your compiled program to a floppy.
6. Take the floppy to the 2900 and follow the  programming instructions .
7. After the microcontroller has been programmed, insert it carefully back into the socket, making sure that the dots line up.
8. Switch the jumper (EXT) to turn off external memory.
9. Get one of us to check your setup before powering back up.
10. After you power up, push your reset switch until the LED light goes off.
11.  Now download the Xilinx program see if your program works.

Part 4--Using the SFR P1 port for the LED
1. Get ledport.c, ledport.bit from u:cse477/lab1
2. Look at ledport.c.  The new bit file wires the FPGA to connect the LED to the P1 port of the microcontroller. 
3. Build, compile, download, and run the program
4. This FPGA bit file maps the MSB of P1 (bit 7,  i.e. P1.7) to the second bit of the parallel port.  Change the program to do something interesting with the led when this bit is toggled.  Use the "sbit varname = P1^7;" declaration to reference this bit's value.

What to Turnin
Turn in your C program that rotates the 7-segment display LEDs and the new program you made for the P1.7 bit.
Demonstrate your implementation that uses this program and have us sign off on the C programs.
 

 BACK TO TOP

 Last Updated:
3/24/99

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