Question: 9. Write a Program in C that does the following. [8 Marks] Use the 4 LEDs connected to pins RAO to RA3 of the
9. Write a Program in C that does the following. [8 Marks] Use the 4 LEDs connected to pins RAO to RA3 of the PIC32 MCU to create a binary counter that counts in binary from Ox0000 to OxFFFF. Push Button1 is connected to RD6 and PushButton2 is connected to RD7. The binary counter will start counting from 0 as long as PushButton1 is pressed. Whenever PushButton1 is unpressed the counter will stop counting and the LEDs will freeze at their current state. If PushButton1 is pressed again after this, then the binary counter will restart counting from 0 again. This is how the binary counter should look like on the development board. LEDS RA3 RA2 RA1 RAO 0000 0001 1 1 1 1 When PushButton2 is pressed the LEDs are all cleared to 0 (switched OFF). Assume the PBCLK of the MCU is set at 80 Mhz. The delay in the timing of the program in between the change of state of the LEDS (ex. Time taken to go from 0 0 0 0 to 0001) should be 200 ms. Assume all DEVCFG registers of the PIC32 MCU have been setup from before.
Step by Step Solution
There are 3 Steps involved in it
include definitionsh define LEDPORT PORTA define LEDTRIS TRISA define BUTTON1PORT P... View full answer
Get step-by-step solutions from verified subject matter experts
