Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

** In C Language ** PROGRAMMING ASSIGNMENTs: Use SysTick interrupt to flash LED0 of the board. The LED should repeatedly turn on for some time

** In C Language ** image text in transcribed
image text in transcribed
PROGRAMMING ASSIGNMENTs: Use SysTick interrupt to flash LED0 of the board. The LED should repeatedly turn on for some time and off for the same time. Use EXTI interrupt of PA5 so that an interrupt is triggered when the push button SW4 is pressed. LED0 has four states and the push button is used to switch between these states. The four states of LED0 are as follows: 1- The LED's on/off time period is a half second. 2- The LED's on/off time period is a second. 3- The LED's on/off time period is two seconds. 4- The LED's flashing is off. For example, if the current state is State 1, the program moves to State 2 when the push button is pressed. If the current task is State 4, the program moves to State 1 when the button is pressed, etc. Hints:- - You can start with the program explained in the slides, named SysTick_Flashing_LED_EXTI_OnOff.c. Run this program first and then modify it. - Use a memory variable called State and initialize it to 1. - In EXTI routine, increment State by one, and if State =5, it should be 1. The do the following: - If the state is 1, enable SysTick interrupt and initialize the timer to trigger interrupts every half second. - If the state is 2 , initialize the timer to trigger interrupts every one second. Page 1 of 3 - If the state is 3 , initialize the timer to trigger interrupts every two second. - If the state is 4 , disable SysTick interrupts. - In the SysTick routine, flip LED0. As you see, the program is written mainly in the interrupt routines of EXTI and SysTick. You can add one task in the main program. In this task, add the program of Lab 9 (Keypad and LCD) in the main program. Observe how the tasks of LCD/keypad, LED flashing, and receiving user input by the pushbutton, are running at same time smoothly The main purpose of interrupts is running multiple tasks simultaneously. PROGRAMMING ASSIGNMENTs: Use SysTick interrupt to flash LED0 of the board. The LED should repeatedly turn on for some time and off for the same time. Use EXTI interrupt of PA5 so that an interrupt is triggered when the push button SW4 is pressed. LED0 has four states and the push button is used to switch between these states. The four states of LED0 are as follows: 1- The LED's on/off time period is a half second. 2- The LED's on/off time period is a second. 3- The LED's on/off time period is two seconds. 4- The LED's flashing is off. For example, if the current state is State 1, the program moves to State 2 when the push button is pressed. If the current task is State 4, the program moves to State 1 when the button is pressed, etc. Hints:- - You can start with the program explained in the slides, named SysTick_Flashing_LED_EXTI_OnOff.c. Run this program first and then modify it. - Use a memory variable called State and initialize it to 1. - In EXTI routine, increment State by one, and if State =5, it should be 1. The do the following: - If the state is 1, enable SysTick interrupt and initialize the timer to trigger interrupts every half second. - If the state is 2 , initialize the timer to trigger interrupts every one second. Page 1 of 3 - If the state is 3 , initialize the timer to trigger interrupts every two second. - If the state is 4 , disable SysTick interrupts. - In the SysTick routine, flip LED0. As you see, the program is written mainly in the interrupt routines of EXTI and SysTick. You can add one task in the main program. In this task, add the program of Lab 9 (Keypad and LCD) in the main program. Observe how the tasks of LCD/keypad, LED flashing, and receiving user input by the pushbutton, are running at same time smoothly The main purpose of interrupts is running multiple tasks simultaneously

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing The Food And Beverage Operation An Operational Audit Approach Volume 1

Authors: Hans L. Steiniger Certified Public Accountant Certified Internal Auditor

1st Edition

1424167698, 978-1424167692

More Books

Students also viewed these Accounting questions

Question

manageremployee relationship deteriorating over time;

Answered: 1 week ago