Digital Signal Processing Reference
In-Depth Information
16.19 Laboratory Exercises
1. Write a C program to blink the eight green LEDs in a reversing shift pattern on the DE
board. After the last LED in each direction turns on, reverse the direction of the shift.
Run and demonstrate the program on the DE board. Recall that C supports shift
operations (“<<” and “>>”) and you will need a time delay in your code to see the LEDs
blink.
2. Write a C program that displays a count of the seconds that the program has been running
in the LCD display on the DE2 board or on the seven-segment displays on the DE1
board. Demonstrate the program on the DE board.
3. Expand the C program in the previous problem to display the elapsed time in hours,
minutes, and seconds on the LCD (or seven-segment displays). Have one pushbutton
reset the time to zero and another pushbutton start and stop the timer just like a
stopwatch.
4. Memory test programs cannot test all possible patterns. Research the various algorithms
widely used in more thorough memory test programs and write your own more advanced
memory test program for SRAM. Most memory test programs use several algorithms to
check for different types of faults. Execute the test code from SDRAM.
5. Write a retro version of the 1970's classic kill the bit computer game for the DE board.
The goal in the kill the bit game is to turn off all of the four LEDs using the four
pushbuttons. The game starts with an initial non-zero pattern displayed in the LEDs. The
pattern constantly does a circular shift moving through the LEDs in a loop with a time
delay to slow down the shifts. If you hit one of the four pushbuttons exactly when the the
same number LED is turned on, it will turn off one LED in the pattern. If you hit a
pushbutton and it's LED is off another LED turns on.
Here is how the program works. Each time just before the pattern shifts, the pattern is bit-
wise exclusive or'ed with one input sample from the pushbuttons to generate a new
pattern. When both the pushbutton is pushed and its corresponding bit in the pattern are
High, one less bit will be High in the new pattern after the exclusive or (i.e., 1 xor 1 is 0).
After the shift, one less LED will be turned on since there is one less “1” in the new
pattern. If your timing is off and the LED is not turned on when you hit the pushbutton, a
new high bit will be generated in the pattern (i.e., 1 xor 0 is 1). When this happens, the
new “1” bit in the pattern lights another LED. Note that you need a “1” when a
pushbutton is pressed and a “1” to turn on an LED for the xor function to work.
Display the elapsed time in the LCD display (or seven-segment displays) and stop the
time display when a player wins the game (turns out all LEDs). Adjust the shift time
delay for reasonable game play. Blink all of the LEDs when a player wins. If you want a
Search WWH ::




Custom Search