Montana Tech of The University of Montana
Computer Science & Software Engineering

CSCI 255
Introduction to Embedded Systems
Fall 2011


Lab #3 - Push the button

The goal of this assignment is introduce you to programming in assembly language on the 8051 microcontroller. You will learn how to use port 0, 1, and 2. You will gain experience using assembly language to create nested loops, conditional branches, and perform bit operations.


Part 1: Countdown
You need to create a count down timer. The timer should start at a value of 108 (decimal) and count down towards 0. The current value of the timer should be displayed in binary using the D0, D1, ..., D7 LEDs. D0 is the least significant bit. An LED should be lit if its corresponding bit position in the binary representation of the timer's value is currently 1. The count down from 108 to 0 should take between 20 and 30 seconds. The LEDs correspond to port 0 pins P0.0, P0.1, ..., P0.7.
Part 2: Blow up the island
Once the timer reaches zero, stop the count down. Flash all 8 LEDs on and off several times a second. At the same time as the flashing LEDs, cause a buzzer to sound. The flashing and beeping continues forever (or until you unplug the board).
Part 3: Save the island
If button P2.0 is pushed when the timer reaches zero, the timer should reset to 108 and start counting down again (without flashing all the LEDs or beeping).


Extra-credit.
Modify your program so the buzzer starts beeping when only 4 seconds are left in the countdown. To save the island, the user must hit the buttons P2.0, P2.2, P2.1, and P2.3 (in that order) during the last 4 seconds. If the sequence is not completed or is out of order, the island blows up.


Submission. Show your working board to Zach or Keith. Hand in a hard copy of your program. Submit your program Lost.asm via Moodle. Be sure your submitted source file has the required header with your name, username, and a description of the program. Your program will be graded on functionality, readability and elegance.

Page last updated: August 16, 2012.  Copyright © 2011 by Keith Vertanen.