

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ECGR 4101/5101 Spring 2008
Due: 2/16/09, at 2:00pm. Assignment should be typed, a hard copy turned in to Lab TA. The TA will be in the lab from 12:00-2:00pm on the due date (but you may turn it in any time before the deadline). Use the template below to prepare your lab report.
The goal of this lab is to introduce you to more of the peripherals available on the QSK board and Programmed I/O.
You are to write a program that runs on your QSK26A board that moves a + character around the LCD display. It is optional to use interrupts (as described below) and update the display every time a button is pressed.
(a) Create a struct that has two unsigned integer variables — x and y. Exactly one global instance of this struct is to be declared. Main will set the initial x to 4, y to
(d) The display subroutine will blank the LCD display, then according to the position of the plus, display the plus at the appropriate place on the LCD screen. (e) In the header comments (bottom of the comment block), add a few lines stating your name, the date, and the purpose of each subroutine. (f) Add an appropriate comment to the procedure you changed that describes your intent. (What are the changes supposed to do?)
The behavior of the interrupts are as follows. If S101 is pressed, then the + moves one position to the left. If the + is already at the leftmost side of the screen x = 0, then it should wrap around to the rightmost side of the screen. If S103 is pressed, then the plus moves to the right. If it reaches the rightmost side of the screen, it wraps around as well. If S102 is pressed the + changes rows. If it was on row 0, it moves to row 1. If it was on row 1, it moves to row 0.
Hints: (1) Your main program will need to have an infinite loop; after setting up every- thing, the interrupt service routines take care of the work. (2) You may want to develop your code incrementally. Start with the App Note and sample code, get one interrupt attached to one switch working. Use the LEDs to help you debug. Then develop the display code and logic for moving the +. (3) Use the sfr26a header files to make setting up the ports and interrupts easy. Complete your lab report and bring your board to the TA to demonstrate the new code. (Note: you do not need to start up HEW.) For the lab report, you do not need to print the entire program: just include printouts of the parts you changed.
Include in the checkout part of your lab report the lines:
Also, include as part of your lab report observations and procedures. Refer to lab 1 for what is expected in your report.