Lab 5 – Interrupts
Configure/Enable GPIO Interrupt … Then Verify it Works
Add Code to Enable Interrupts
7. Open main.c and modify initGPIO() to enable the interrupt for your push-button.
If you need a hint on what three lines are required, refer back to the Lab 5 Worksheet,
question number 7 (see page 5-39).
Note that the pin numbers are the same, but the switch names differ for these Launchpads:
− For the F5529 Launchpad, we’re using pushbutton SW2 (P1.1)
− For the FR5969 Launchpad, we’re using pushbutton SW3 (P1.1)
8. Add the line of code needed to enable interrupts globally (i.e GIE).
This line of code should be placed right before the while{} loop in main(). Refer back to the
Lab 5 Worksheet, question number 8 (see page 5-40).
9. Build your code.
Fix any typos or errors.
Start the Debugger and Set Breakpoints
Once the debugger opens, we’ll setup two breakpoints. This allows us to verify the interrupts
were enabled, as well as trapping the interrupt when it occurs.
10. Launch the debugger.
11. Set a breakpoint on the “enable GIE” line of code in main.c.
12. Next, set a breakpoint inside the ISR in the unused_interrupts.c file.
MSP430 Workshop - Interrupts 5 - 45