CS201 Lab: Blinking Lights

Objective of this lab:


	In this lab assignment, you are going to practice on how to 
	implement the procedure calls in SPIM. 

Preparation


	Read lab lecture notes and the  lecture notes of hardware component.

Lab Assignment

Procedure

Your job is to blink the red and yellow LED's similiar to a train crossing. 
(One light comes on for approximately a second and then goes out and the other 
light comes on for a second and then goes off). The procedure should last for 
30 seconds giving the short train enough time to cross the road.

Helpful programming tips

    * In order to create a big loop around your program, 
      you can store a variable in a register that is not temporary. 
      If you want your project to loop through 30 times, 
      you need to store a variable initialized to 30.
    * Secondly you need to create delays or loops to keep the light on or off. 
      Simply turning the LED on and then off will happen too quickly 
      for you to see the light on. To build delay loops use values of 100000 
      and then go up or down as necessary.
    * Please remember that using printf is slow ( a lot of code happens) 
      so that could delay your program significantly.
After you have finished, have a lab instructor come and look at your work.

Bonus Marks

For Bonus Marks we would like you to create the following application. 
You will notice that each LED has a push button beside it. 
The goal is to control the LED with the switch located beside it. 
Pressing down on the switch should light the LED.

NOTE -- The I/O pins attached to the switches are high when they are not pressed. 
Pressing down on the switch will set the I/O pin low. To light up a LED you must 
write a '1' to the output.

Other Programming help

//Helpful programming instructions:
  //And certain bits
  andi $s1, $s1, 0x000020C0  /* Bits 13, 7, 6 */
  
  //Shifting bits
  srl $t0, $s1, 11

  //Exclusive Or 
  xori $t0, $t0, 0x4

This page last modified:
Friday, 21-Aug-2020 15:27:39 CST
Accessed     times.


Copyright: Department of Computer Science, University of Regina.