I have a behavioral issue that I was hoping someone could help me with. I have a button attached to PORT1 of MSP430G2553, and I have the interrupt configured in GRACE. My interrupt routine is located immediately below my Main() code, and is as follows:
// Update input/outputSelection variables after button press
__interrupt void PORT1_ISR(void)
{
inputSelection++;
P1IFG &= ~BIT0; // P1.0 IFG cleared
}
I determined that the code wouldn't compile if this line: #pragma vector=PORT1_VECTOR was in the code. My issue is this: if the button is pressed, the code does go through PORT1_ISR, inputSelection (global variable) is incremented within that ISR, but then once the code returns to the main function, the inputSelection variable is reset back to 0. How can I make the interrupt routine increment a counter that will be accessible in the main program routine?