Write a program to repeat the following tasks continuously. Turn all four LED li
ID: 2987962 • Letter: W
Question
- Write a program to repeat the following tasks continuously.
- Turn all four LED lights OFF.
- Wait in a loop until one of the push buttons is pressed.
- After that, all LEDs must start turning ON and OFF five times with a one-second delay in between.
- Cut and paste the source code.
- Single-step the code and verify that that the code stays in a loop, waiting for a pushbutton press. Press and hold down SW4, and single-step the code so that it exits out of the loop waiting for a pushbutton press. While you are still holding down the pushbutton, in the Data:1, scroll down and right click on _PT01AD, then left click on Show Location. The value of the PT1AD variable should appear in the Memory window. What is the value of PT1AD? Cut and paste the Memory window showing the value of PT1AD.
- Press the Reset button on the Tower board and run the code. What are the LED values when you press SW2? Describe what you observe when you press any of the pushbuttons.
Explanation / Answer
/* each LED is addressed by an address (byte) and a bit-within-this-byte */ struct { address, bit } LEDConfigPair; struct LEDConfigPair LEDConfig[NUMBER_OF_LEDS] = { {GPIO_PORTB_BASE,0}, {GPIO_PORTB_BASE,1} } ; led_init(void) { U32 i; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.