https://os.mbed.com/docs/mbed- os/v6.15/apis/interruptin.html. Refer to the first usage example of the class reference to see how an Interruptin object can be used to trigger an event based on the rising edge of a digital input signal associated with a push button press.
Prelab 1. Start a new project. 2. Configure the USER_BUTTON input as an external interrupt that will call an Interrupt Service Routine (ISR) on the falling edge of the button (when the button is pressed). 3. Write an ISR that toggles LED1 (PA_5) every time the button is pressed. 4. Compile and test. 5. Demonstrate functioning program to the laboratory instructor or take a video to upload to D2L. Laboratory Procedure: 1. Modify the prelab code to so that it will now respond to two events: when USER BUTTON is pressed and when USER_BUTTON is released. For each event there should be a corresponding ISR. For the "button press" ISR, turn LED1 (green) on. For the "button release" ISR, turn LED1 (green) off. The default value of LED1 should be defined as OFF at the beginning of main program. 2. Refer to the documentation for the Timeout API, which is used to set up an interrupt to call a function after a specified delay. https://os.mbed.com/docs/mbed-os/v6.15/ ... meout.html 3. Modify the code in step 1 to turn LED1 off 1 second after the USER_BUTTON has been released. Do this by nesting a Timeout event inside the "button release" ISR and creating an ISR to respond to the Timeout event. 4. Demonstrate functioning program to the laboratory instructor or take a video to upload to D2L.
EE 3501 Laboratory 7: Interrupts and Timers Name: Learning Objective: Date: Use Mbed API to support interrupt-driven processing. Introduction What is an Interrupt An interrupt is a hardware-invoked function/subroutine call, that is, a hardware signal generated by an event internal/external to the microcontroller is used to generate a call to a subroutine called an Interrupt Service Routine (ISR). Once the ISR is executed, execution returns to the main program. Processes Involved in Interrupt Servicing There are certain processes associated with servicing an interrupt. 1. Interrupt signal is detected. 2. Processes stops execution in main program. 3. Auto stacking to preserve environment of main program. 4. Load address of ISR into PC using Interrupt vector table. 5. Execute ISR. 6. Interrupt returns. 7. Auto unstacking. Interrupts in Mbed Mbed provides the InterruptIn API to trigger an interrupt event when a digital input to target microcontroller changes. These interrupts can be triggered on the rising or falling edge of signals. The class reference for InterruptIn can be found at EE 3501 Laboratory 7: Interrupts and Timers Name: Learning Objective: Date: Use Mbed API to support interrupt-driven pro
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am