Hi,
I am trying to generate an interrupt using a Push button on Port 2.4 so that my LEDs toggle.
My problem is that my code never seems to be going to ISR . I dont know how to go along from here.
I am very new MSP430 TI so please any help will be greatly appreciated.
My code is as follows
#pragma vector = PORT2_VECTOR
__interrupt void Port_2(void){
_DINT();
//BUTTON 0
if (P1IFG & BIT4)
{
P4OUT ^=BIT4;
}
//BUTTON 1
else if (P1IFG & BIT5)
{
// do something
}
P1IFG = 0;
_EINT();
}
void main(void){
P4DIR |= 0x1F;
P4OUT &= ~0x1F; //output
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P2DIR &= ~0x10; //P2.0 as input
//P2OUT = 0x01;
//P2SEL = 0x00;
P2IE |= 0x10; // No interrupt is pending
P2IES &= ~0x10; // The PxIFGx flag is set with a high-to-low transition
P2IFG &= ~0X10; // The interrupt is enabled
P2REN = 0x10;
_EINT();
//__bis_SR_register(GIE);
}
I dont seem to know what exactly my code is doing as my code never really goes to ISR.