Lab 6: Interrupts and Timers
 
In this lab we will introduce interrupts and the hardware timer. We will write a program that is similar in function to that of lab 3: we flash some LEDs when we start the program, then activate individual LEDs with the pushbutton switches, each switch lighting a unique LED for a specified amount of time. We will also continuously blink the leftmost LED on the board.
 
In the lab 3 demo, we used polling to check for key presses and a software delay to generate the timing for the LED on-state. The code was easy to write, but it was inefficient - the program wasted a large amount of valuable CPU time.   The delay subroutine simply counted down from a large number to waste time.  The CPU could not be used to do other more useful activities while counting down. In this lab, we use a more efficient approach based on interrupts and hardware timers.
 
1-Pre-lab
 
For the pre-lab, write a brief one-page report describing the main differences between an interrupt and a subroutine. Note the differences in how they are called and how they return, how they use the stack, etc.
 
 
2-Tutorials
 
(a) Read the interrupts overview.
 
(b) Read the timer overview.
 
(c) Read and do the timer demo.
 
 
3-Program
 
    * Make a program from scratch that is similar to that of the timer demo, except your new program has the following specifications:
 
     (a) - All Port B LEDs should all flash on for a half-second when the program is first started.
 
     (b) - LED5 (of 0-7) should light for a half-second when we push switch sw5.
 
     (c) - Switches sw2, sw3 and sw4 should be dead (nothing visible should happen when we push them).
 
     (d) - LED7 should constantly flash at a rate of every 1/8 of a second (on 0.125 seconds, off 0.125 seconds, etc). It should not have erratic timing. LED7 timing should be based on the RTI.
 
     (e) - This must be interrupt driven and use hardware timers.
 
      Due to integer math limitations, the flash rates noted above do not have to exactly equal the desired rate, but it should be close, within a few percent or so.
 
    * Following the steps outlined in the stationery tutorial above, create a new project called "lab6" from the ee3176 stationery. Name you absolute executable "lab6.abs" and your source code "lab6.asm".
 
    * Build and run the program. Debug it as necessary until it runs correctly.
 
    * For checkout, verify to the TA that the program works OK.
 
 
4-What to Hand In
 
At the next lab, hand in the commented code from your program from above. Remember to include your: (1) name; (2) date; (3) class (eg, UTEP EE3176);(4) the name of the program (eg, "lab6.asm"); and (5) what the program does. In addition, there should be comments throughout your program that describe what the main sections of code do.
 
 
EE3176 Lab 6