Other Parts Discussed in Thread: MSP430G2553
I am using MSP430g2553 chip. and I wrote the following small code to initialize and enable the port 2 interrupt. I have attached a 100HZ 1.25 volt square wave with 30 duty cycle to P2.0 and P2.1. I place break point in my interrupt handler. When I run the code my break point is never hit, it looks like some how the interrupt vector is not a correct ? .I also checked that against the msp430g2553.h.A response is highly appreciated.
void main(void) {
static struct timeT timeFlash_FanCheck;
//static struct timeT timeFanCheck;
static int ADC_proc;
//initialize peripheral and other
WDTCTL=WDTPW+WDTHOLD; //stop watchdog timer
low_level_init();
timera_init();
//port 2 setup interrupt configuration
P2SEL &= ~(BIT0+BIT1+BIT2+BIT3);
P2DIR &=~(BIT0+BIT1+BIT2+BIT3);
P2IFG=0x00;
P2IES &=~(BIT0+BIT1+BIT2+BIT3);
P2IE |=BIT0+BIT1+BIT2+BIT3;
_
while(1)
{
//every 1 second call
readFanSpeed(); //will use TachCount to measure the fan speed
}
// Fan Tach PORT2 Interrupt Service Routine
#pragma vector = PORT2_VECTOR
__interrupt void isrPORT2(void)
{
_NOP();
//configure port2 pins0,1,2,3 IE in low_level_init()
if (P2IFG & TACH_FAN_1) // Tachometer pulse detected ?
{
Fans[0].TachCount++; // Increment tach counter
P2IFG &= ~TACH_FAN_1; // Clear interrupt flag
}
if (P2IFG & TACH_FAN_2) // Tachometer pulse detected ?
{
Fans[1].TachCount++; // Increment tach counter
P2IFG &= ~TACH_FAN_2; // Clear interrupt flag
}
#if 0
if (P2IFG & TACH_FAN_3) // Tachometer pulse detected ?
{
Fans[2].TachCount++; // Increment tach counter
P2IFG &= ~TACH_FAN_3; // Clear interrupt flag
}
if (P2IFG & TACH_FAN_4) // Tachometer pulse detected ?
{
Fans[3].TachCount++; // Increment tach counter
P2IFG &= ~TACH_FAN_4; // Clear interrupt flag
}
#endif
}
I will never get to the interrupt routine above to increment the tach signal.