This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interrupt Help for ADC12 and PORT for MSP430FR6989

I need some help with my program that I'm trying to implement. I have multiple interrupts in my program and all are working just fine except the ADC12 and PORT Interrupt. When the ADC12 interrupt is flagged it immediately goes into the PORT's interrupt and then continues into the ADC's interrupt. This only happens when I first run the program. Problem is I only want the PORT interrupt to happen if there is a hi-lo edge detection (since I'm doing a count and it needs to be accurate). But I can't seem to figure out how to prevent it from going into the PORT interrupt. 

I am using this ADC example in my program (which I changed things around for my project) and I moved over the PORT interrupt. If you run the program and set a breakpoint in each interrupt you can see that it goes straight into the PORT interrupts and then again in to the ADC. I didn't show the condition from my program where I am actually calling the PORT interrupt because that's working fine. It's just upon the first run of the program I am stuck on. 

//******************************************************************************
//  MSP430x26x Demo - ADC12, Sequence of Conversions (non-repeated)
//
//  Description: This example shows how to perform A/D conversions on a sequence
//  of channels. A single sequence of conversions is performed - one conversion
//  each on channels A0, A1, A2, and A3. Each conversion uses AVcc and AVss for
//  the references. The conversion results are stored in ADC12MEM0, ADC12MEM1,
//  ADC12MEM2, and ADC12MEM3 respectively and are moved to 'results[]' upon
//  completion of the sequence. Test by applying voltages to pins A0, A1, A2,
//  and A3, then setting and running to a break point at the "_BIC..."
//  instruction in the ISR. To view the conversion results, open a watch window
//  in debugger and view 'results' or view ADC12MEM0, ADC12MEM1, ADC12MEM2, and
//  ADC12MEM3 in an ADC12 SFR window.
//  This can run even in LPM4 mode as ADC has its own clock
//  Note that a sequence has no restrictions on which channels are converted.
//  For example, a valid sequence could be A0, A3, A2, A4, A2, A1, A0, and A7.
//  See the MSP430x1xx User's Guide for instructions on using the ADC12.
//
//            MSP430F261x/241x
//            -----------------
//           |                 |
//   Vin0 -->|P6.0/A0          |
//   Vin1 -->|P6.1/A1          |
//   Vin2 -->|P6.2/A2          |
//   Vin3 -->|P6.3/A3          |
//           |                 |
//
//  B. Nisarga
//  Texas Instruments Inc.
//  September 2007
//  Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.42A
//******************************************************************************

#include  <msp430.h>

volatile unsigned int results[4];             // Needs to be global in this example
                                            // Otherwise, the compiler removes it
                                            // because it is not used for anything.
volatile int uncorrected_count = 0;
volatile int x = 0;

void main(void)
{
  WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer
  P8SEL0 = 0xE0;                             // Enable A/D channel inputs
  P8SEL1 = 0xE0;
  ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_2;           // Turn on ADC12, set sampling time
  ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1;                 // Use sampling timer, single sequence
  ADC12MCTL0 = ADC12INCH_5;                      // ref+=AVcc, channel = A0
  ADC12MCTL1 = ADC12INCH_6;                      // ref+=AVcc, channel = A1
  ADC12MCTL2 = ADC12INCH_7;                      // ref+=AVcc, channel = A2
  ADC12MCTL3 = ADC12INCH_3+ADC12EOS;                  // ref+=AVcc, channel = A3, end seq.
  ADC12CTL0 |= ADC12ENC;                         // Enable conversions
  ADC12IER0 = 0x08;

  //Set P1.6 to input direction for Hall Sensor
  P1OUT |= BIT6;							// Pull-up resistor on P1.1
  P1REN |= BIT6;                          	// P1.5 pull-up register enable
  P1IES |= BIT6;                          	// P1.5 Hi/Low edge
  P1IFG |= 0;								// Clear all P1 interrupt flags
  P1IE |= BIT6;                           	// P1.5 interrupt enabled
  PM5CTL0 &= ~LOCKLPM5;

  while(1)
  {

      ADC12CTL0 |= ADC12SC;                     // Start convn - software trigger
     _BIS_SR(GIE);                 // Enter LPM0, Enable interrupts

}
}

#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
{
  results[0] = ADC12MEM0;                   // Move results, IFG is cleared
  results[1] = ADC12MEM1;                   // Move results, IFG is cleared
  results[2] = ADC12MEM2;                   // Move results, IFG is cleared
  results[3] = ADC12MEM3;                   // Move results, IFG is cleared
  ADC12IER0 = 0x00;
  _BIC_SR_IRQ(LPM0_bits);                   // Clear LPM0, SET BREAKPOINT HERE
}

//******************************************************************************************
// Port 1 interrupt service routine
//******************************************************************************************
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
  #pragma vector=PORT1_VECTOR
  __interrupt void Port_1(void)
#elif defined(__GNUC__)
  void __attribute__ ((interrupt(PORT1_VECTOR))) Port_1 (void)
#else
  #error Compiler not supported!
#endif
  {
	uncorrected_count = uncorrected_count+1;
    P1IFG &= ~BIT6;													// Clear P1.6 IFG
    __bic_SR_register_on_exit(LPM3_bits);								// Exit LPM3
}

**Attention** This is a public forum