Part Number: MSP430FR2433
Tool/software: Code Composer Studio
Hi,
I am using PORT Interrupts.
My Program is :
i) P2.7 is connected with switch (Interrupt).
ii) P3.2 is connected with LED.
When switch is pressed, LED will be on.
/*
* PORT2 VECTOR DEFINED=========================================================
*/
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
if (P2IFG & 0x80) {
P2IFG &= ~0x80; //P2.7 connected magnetic switch.
pattern=1;
__bic_SR_register_on_exit(LPM3_bits);
}
}
/*
* MAIN FUNCTION=================================================================
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
///LED DEFINE-----------------------------------------------------
// P3OUT &= ~BIT2; // Clear P1.0 output latch for a defined power-on state
P3DIR |= BIT2 ; // Set P3.2 to output direction
//PORT INTERRUPT DEFINE------------------------------------------
P2DIR &= ~BIT7; //p7 --magnet, P2DIR &= ~BIT7;
P2IES |= BIT7;
P2IFG &= ~BIT7;
P2IE |= BIT7;
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
/
//start----------------------------------------------------------------------
while(1)
{
__bis_SR_register(LPM3_bits+GIE);
if(pattern > 0)
{
pattern = 0 ;
P3OUT &= ~BIT2; //LED is working, I tested it without interrupt in my customized board.
__delay_cycles(800000);
P3OUT |= BIT2;
}
}
//return 0;
}
Can anyone please tell me,
what mistake I am doing?
so that the Interrupt is not working.
Regards,
Srijit.