Lab 05 Worksheet (3)
Interrupt Service Routine
8. Write the line of code required to turn on interrupts globally:
_________________________________ // enable global interrupts (GIE)
Where, in our programs, is the most common place we see GIE enabled?
(Hint, you can look back at the slides where we showed how to do this.)
______________________________________________________
Interrupt Priorities & Vectors
9. Which interrupt has higher priority: GPIO Port 2 or WDT Interval Timer?
______________________________________________________
Let’s say you’re CPU is in the middle of the GPIO Port 2 ISR, can it be
interrupted by a new WDT interval timer interrupt? If so, is there anything
you could do to your code in order to allow this to happen?
______________________________________________________
______________________________________________________
__bis_SR_set( GIE );
Right before the while{} loop in main().
No, by default, MSP430 interrupts are disabled when running an ISR. To
enable this you could settup interrupt nesting
(though this isn’t recommended)
WDT Interval Timer (INT 56 vs GPIO P2 at INT 42)
Lab 05 Worksheet (4)
10. Where do you find the name of an “interrupt vector”?
______________________________________________________
______________________________________________________
11. How do you write the code to set the interrupt vector? (Hint, we’ve
provided a simple ISR to go with the line of code we’re asking you to
complete.)
// Sets ISR address in the vector for Port 1
#pragma ___________________________________
__interrupt void pushbutton_ISR (void)
{
// Toggle the LED on/off
GPIO_toggleOutputOnPin( GPIO_PORT_P1, GPIO_PIN0 );
}
What is wrong with this GPIO port ISR?
______________________________________________________
______________________________________________________
Interrupt vector table in the datasheet. (It’s also defined in the device
specific header file (e.g. msp430f5529.h))
vector=PORT1_VECTOR
GPIO ports are group interrupts, which should read the P1IV register
and handle multiple interrupts using a switch/case statement