Code composer studio, C code, using the msp432 4. Write your code to perform the
ID: 3884452 • Letter: C
Question
Code composer studio, C code, using the msp432
4. Write your code to perform the following:
Upon startup or program reset, all LEDs should be OFF.
The first push of the button should light the green LED and it should stay on.
On the second push of the button, the green LED should turn off and the yellow LED should turn on (and stay on).
After the third push of the button, the yellow LED should turn off and the red LED should turn on (and stay on).
After the fourth push of the button, the red LED should turn off and the green LED should turn on (and stay on).
For each subsequent button push, the LEDs should repeat the sequence described above (one LED on at a time, each turning on and off in response to a button press).
5. Note: It will be important to include in your program a way to handle "switch bounce" or else you will find your sequence will not always work the way it’s designed.
To design for a possible switch bounce in your software, measure the switch bounce by connecting the digital probe attachment to the oscilloscope (as in lab 2) and one of the digital probes to the input port pin of the MSP432 where the switch interface is attached (don’t forget the ground reference connection). Observe the logic trace for several presses and releases of the push button. Determine how long the switch bounce lasts that could create a problem for your program to detect a single button press.
6. Design a delay function that can create millisecond delays by writing a C function that uses the MSP432 _delay_cycles() function (soon we will learn how to use a timer that will produce more accurate time intervals). Use this function that passes the number of milliseconds delay needed as a function argument.
7. Use the delay function to avoid reading the switch during a switch bounce interval.
Explanation / Answer
Hi try to use below code because it it very usefull to you
progarm:
Thanks