Below find code for which I have written for detection of positive to negative edge for MSP430F1122.
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
__enable_interrupt(); //Enable interrupt
P1DIR |= 0x01;
P2DIR &= ~0x01; //P2.0 as input port
P2SEL &= ~0x01;// P2.0 as I/O pin for detection of falling edge
P2IE |= 0x01; // P2.0 INTERRUPT ENABLE
P2IES |= 0x01; //P2.0 port will detect pos to neg edge
for (;;) // polling P2.0
{
volatile unsigned int i;
if (P2IFG == 1 )
{
P2IFG &= ~0x01; //Clear Interrupt after trigger.
P1OUT |= 0x01; // P1.0 LED Will be ON for a while
i = 500; // Delay
do (i--);
while (i != 0);
}
else
{
P1OUT &= ~0x01; // P1.0 LED remains off
}
}
return 0;
}
But it does not give me result. Why this simple detection of edge is not
giving me output ?