Lab 05 Worksheet (5)
12. How do you pass a value into (or out from) and interrupt service routine
(ISR)?
______________________________________________________
ISR’s for Group Interrupts
As we learned earlier, most MSP430 interrupts are grouped. For example, the
GPIO port interrupts are all grouped together.
13. For dedicated interrupts (such as WDT interval timer) the CPU clears
the IFG flag when responding to the interrupt. How does an IFG bit get
cleared for group interrupts?
______________________________________________________
______________________________________________________
Interrupts cannot pass arguments, we need to use global variables
Either manually; or when you read the IV register (such as P1IV).
Lab 05 Worksheet (6)
14. Creating ISR’s for grouped interrupts is as easy as following a ‘template’.
The following code represents a grouped ISR template. Fill in the blanks
required for the CPU to toggle the LED (P1.0) in response to a GPIO
pushbutton interrupt (P1.1).
#pragma vector=PORT1_VECTOR
__interrupt void pushbutton_ISR (void) {
switch(__even_in_range( ____________, 10 )) {
case 0x00: break; // None
case 0x02: break; // Pin 0
case 0x04: //break; // Pin 1
__________________________________
break;
case 0x06: break; // Pin 2
case 0x08: break; // Pin 3
case 0x0A: break; // Pin 4
case 0x0C: break; // Pin 5
case 0x0E: break; // Pin 6
case 0x10: break; // Pin 7
default: _never_executed(); }
P1IV
GPIO_toggleOutputOnPin( GPIO_PORT_P1, GPIO_PIN0 );