The G2 LaunchPad has two LEDs and two push buttons. This thing below tests them. But the ISR is naughty.
#include <msp430.h>
void main(void)
{
WDTCTL = WDTPW | WDTHOLD;
P1OUT = BIT3; // S2 push button
P1DIR = BIT6 | BIT0; // green LED, red LED
P1REN = BIT3; // pull-up with internal resistor
P1IE = BIT3; // S2
P1IFG = 0;
_BIS_SR (GIE);
while (1);
}
#pragma vector = PORT1_VECTOR
__interrupt void naughty (void)
{
P1IFG <<= 1;
P1IE <<= 1;
__delay_cycles (100000);
P1OUT |= BIT0; // red LED on
__delay_cycles (400000);
P1OUT &= ~BIT0; // red LED off
_BIS_SR (GIE);
__delay_cycles (100000);
P1OUT |= BIT6; // green LED on
__delay_cycles (400000);
P1OUT &= ~BIT6; // green LED off
}