Hello everyone,
I recently purchased a MSP430FR2311 LaunchPad board. I wrote a program to Toggle the On board LED(P1.0) when the on board Push Button(P1.1) is pressed. The program was written to generate PORT 1 interrupt
and inside the ISR i wrote the code to toggle the LED. This workd fine when tested.
Now i just expanded the program by writing the same LED toggle for P1.5 and P2.2. I connected two more external push buttons with pull up resistor. On running this program, i get interrupt for P1.5 and P1.1 as expected, but the interrupt is not generated for P2.2 push button.
On debugging the P2IN register, i was able to see the 3rd bit in set state when button is not pressed(Pull up mode), and on pressing the bit being in reset state but not sure why interrupt is not being generated.
Can someone help me in figuring out whats going on here? I'm pasting the code below for reference
Also, i have one more clarification. The few GPIO pins of P1 given in the MSP430FR2311 Launpad had a name of I/O! near to pins and P2.2 has I/O without ! .What does this mean ? My assumption is I/O! means by default Pull Up and I/O means Pull Down. Is my assumption correct?
int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT P1DIR |= BIT0; P1OUT |= BIT0; PM5CTL0 &= ~LOCKLPM5; //configure P1.1 & P1.5 P1REN |= BIT1 + BIT5; P1OUT |= BIT1+ BIT5; P1IE |= BIT1+ BIT5; P1IES |= BIT1+ BIT5; P1IFG &= ~BIT1+ BIT5; //configure P2.2 P2REN |= BIT2; P2OUT |= BIT2; P2IE |= BIT2; P2IES |= BIT2; P2IFG &= ~BIT2; _BIS_SR(GIE); while(1); } #pragma vector = PORT1_VECTOR __interrupt void PORT1_ISR(void) { switch(__even_in_range(P1IV, P1IV_P1IFG0)) { case P1IV_P1IFG1 : // Button S1 pressed { P1OUT ^= BIT0; } break; case P1IV_P1IFG5 : // Button S2 pressed { P1OUT ^= BIT0; } break; default: { } break; } } #pragma vector = PORT2_VECTOR __interrupt void PORT2_ISR(void) { switch(__even_in_range(P2IV, P2IV_P2IFG0)) { case P2IV_P2IFG2 : // Button S3 pressed { P1OUT ^= BIT0; } break; default: { } break; } }