Question: Write a program to create a 3-bit Ring Counter With Direction using the built-in LEDs for the MSP432 Launchpad. The program will use the S1
Write a program to create a 3-bit Ring Counter With Direction using the built-in LEDs for the MSP432 Launchpad. The program will use the S1 and S2 buttons for input. One button will increment the counter and the other will decrement the counter. The RGB LED (LED2) will indicate the state (or value) of the counter and the Red LED (LED1) will indicate the direction of the most recent button event (i.e. was the last button press an increment or decrement)
Register level configuration using bitwise operators and proper mask must be used to configure all registers o The program may not use any DriverLib function calls
The program must have an init() function containing all one-time configuration The increment/decrement functions must be activated with the built-in buttons S1 (P1.1) and S2 (P1.4)
The program must configure internal pull-up/pull-down resistors on inputs
The RGB LED should change state only once for every button event o A button event is defined as the press and release of a button o Both the press and the release must be de-bounced
The program must poll the S1 button for its value (No interrupt service routine)
The states for the RGB LED as defined as follows:
| Count/State | LED2(RGB) |
| 1 | Off |
| 2 | Red (R) |
| 3 | Green (G) |
| 4 | Yellow (RG) |
| 5 | Blue (B) |
| 6 | Pink (RB) |
| 7 | Sky Blue GB) |
| 8 | White (RGB) |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
