CS 273 Lab 9: Debug my Sensors
Dept. of Computer Science, NMSU
Fall 2006
Due Date: Thursday session Nov. 2; Tuesday session Nov. 7
This is a team assignment. Individuals do not need to work on their own solution. Team members should
work together, and should avoid trying to solve the problem on their own.
In the last lab, you will access an already-assembled program that would print out the values of light
sensors in the gdl comm window. It was the program debugsensors.s19.
For this lab, you need to write this program yourself. You need two versions of your program:
- One to print out your touch sensor values (the switches, i.e., Port C). You will only print out
one byte at a time, since all 8 switch positions make up just one byte, and
- One for your light sensors (either the upper four channels or the lower four, whichever you
have been using). You only need to print out four light sensor values (your choice), but if you
want to do all eight, feel free to.
Your program must have at least the following procedures or functions:
- A procedure that takes an 8-bit value as one argument, a 0/1 flag as a second argument, and
returns an 8-bit value as a return value, where the return value is the ASCII value of the lower
hex digit (flag==0) or the ASCII value of the upper hex digit (flag==1) of the input value.
(Recall that an 8-bit value is represented in hexadecimal as two hex digits. In your program
you need to calculate and print each digit separately.)
- A procedure that takes an 8-bit value and outputs it on the serial comm window of gdl (using
HC11 serial communications).
For this assignment, you must submit your assembly programs through the web, you must demonstrate
one of them to a TA or the instructor, and you must submit a team lab report.