Question: Real Time Embedded Systems: 2. The requirement for this question is to simply measure the time elapsed while a single button {GPIO} is being pressed

Real Time Embedded Systems:

Real Time Embedded Systems: 2. The requirement for this question is to

2. The requirement for this question is to simply measure the time elapsed while a single button {GPIO} is being pressed using interrupts. The GPIO pin is pulled to a high state when the button is not depressed. In this application, the button is mechanical and experiences signicant bouncing. The goal is to measure the contiguous time [in ms} between when the button is pressed and when the button is released, excluding the bouncing. See diagram below. timeElapsed You have already setup 3 interrupt handlers. One handler is the ISR that handles Timero's overow. That timer is set up with a prescaler of 32. a counter TOP value of 250, and is set up to reset to 0 and count up to TOP. The CLK is running at 16MH2. Here is the handler denition: void Timer9_0V_HandIerr J The other 2 handlers are for the pin that Is connected to the button. One handles the RISING transition. and the other handles the FALLING transition. Here are the denitions: void pinRisingJiandIex-(J void pink I Iingr_HandIer(} Write the required code snlpplts (In each handler) that assigns the variable time-Elapsed to the specified time in the timing diagram. You may add any additional variables, but be sure to state any assumptions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!