Debouncing
The purpose is to debounce switch inputs.
Part 1: Coding
Write a C-language program to run continuously on your TMS 432 board to do the following functions:
• Configure the “Gator Hole” pin on the BoosterPack board as an input. Configure these Red LEDs as outputs: LED1 (on the main LaunchPad board), Red LED2 (also on the Main LaunchPad board) and Red from the RGB LED on the BoosterPack board.
• Use the three Red LEDs to display a 3-bit, binary count of the number of times you have closed the contact between the Gator Hole and ground. Use an Alligator clip or similar wire to server the function of the bouncing switch contact. The Red LED on the BoosterPack should be your LSB, and LED1 should be your MSB. Your counter should roll over: 0, 1, 2, . . , 7, 0, 1, . . .
• The binary count you display should increment when you close the contact, but should not increment when you release the contact. The count should be based on a fully debounced version of this contact make/break. The reaction to the make and break should be responsive, i.e. should react on a human time scale to several presses per second, but should not respond to contact bounce. Holding the contact closed for a very long time should not produce additional counts.
• Not a requirement, but for a Bonus: you can add the use of S1 on the BoosterPack to light the Blue LED on the BoosterPack, and S1 to light the Blue LED2 on the LaunchPad board. All of these switch operations should be fully independent. i.e. You should be able to operate each switch press and release while other contacts are being held in any state.
Part of the assignment is to figure out port and bit numbers for each of these inputs and outputs.
Your program should perform any and all initializations to make sure the hardware is in the right configuration to do these tasks. You should ONLY touch the hardware that you need to manipulate to do this job! If you change any other bits of I/O hardware, your program is wrong, and would create problems in a bigger system.
Part 2: Questions
Answer the following questions, placing the answers as comments in your code at the end of the listing.
1) How responsive should a debouncing routine be? In other words, what range of rates for button presses should reasonably be responded to? (How many presses per second?)
2) Why are we putting the complexity of debouncing the switches inside of software rather than building an external circuit to do the job and make our software job easier?