Hi,
I am trying to read the high to low transition on Pin 2.7 of MSP4302132 and then turning ON a LED. Pin 2.7 is configured to be an external interrupt (input) and LED is turned ON in its interrupt service routine. LED is connected to Pin 3.3. For some reason the micro is unable to read the high to low transition on pin 2.7 and therefore LED is getting turned ON. The code used is given below.
The external interrupt is actually 60Hz AC line so the interrupt should be triggered every 16.6 ms. There is an external pull resistor being used for pin 2.7 to get a smooth square wave at the pin. I can actually see on a scope a smooth square wave coming in at that pin but the micro is not doing what it is suppose to do.
I am just wondering if I have configured the micro is a wrong way or am I missing something somewhere..... please help
#include "msp430x21x2.h"
void main()
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
DCOCTL = 0;
BCSCTL1= CALBC1_8MHZ; // System Clock Settings
DCOCTL = CALDCO_8MHZ; // use calibrated 8MHz settings
P2DIR &= (~BIT7); // external Ac input
P3DIR |= BIT3; // LED
P3OUT &= ~BIT3; // Initially LED turned OFF
P2IE |= BIT7; // interrupt enabled
P2IES |= BIT7; // Hi to Low transition activates interrupt
P2IFG &= ~BIT7; // Interrupt flag cleared initially
__bis_SR_register(GIE);
for(;;)
{
//trap the CPU
}
}
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
P3OUT |= BIT3; // turning ON the LED
P2IFG &= ~BIT7;
}