ECE 2984 Exam #1: 11:15 March 20, 2009
1. Assume that a memory-mapped register named OUTPUT has been defined whose
least-significant bit is connected to an output pin and whose other bits are unused.
Write an assembly language subroutine that receives a 32-bit word from a C
program and outputs the word serially, most-significant bit first, in the following
manner. To output a zero bit, the output pin is set high for 1µsec and then set low
for 3µsec. To output a one bit, the output pin is set high for 3µsec and then set
low for 1µsec. The timing should be close, but does not have to be perfect. You
may assume that the output bit is zero upon entry to the subroutine. The
prototype for the subroutine in the calling program is:
extern “C” void send(unsigned int data);
2. Rewrite the code for the Button_Push subroutine in C. This subroutine is called
with a mask based on the switch of interest and should return a one if a debounced
0-1 transition has taken place on the switch and a zero otherwise. Assume that
the sleep routine you wrote for homework 4 is available and that the SWITCHES
register is located at memory address 0x8643000C. The relevant prototypes are:
extern “C” void sleep(unsigned int microseconds);
int Button_Push(unsigned int mask);
Each program should be on a separate sheet of paper. Readability and comments
are important. You do not need block header comments for this test.