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.

MSP430F5529: ADC interrupt function issue

Part Number: MSP430F5529

Hi team,

The customer sets up an adc interrupt function to import data from MEM0 into an array of their own settings. After collecting a sample of data, the ADC is turned off directly in the interrupt function (ADC12ON ADC12ENC ADC12SC is set directly to zero), and based on the debug results, the customer sets index=2 as the condition to turn off the adc:

After checking all the steps, index=2 and execute the close adc statement and end the interrupt function run, the interrupt function is run again and the index is +1 based on the statement; after the run is complete, the monolithic is stuck at the end of the interrupt function, cannot jump out and cannot execute the pause button on the ccs interface.

At this point, index=2, and execute the if content.

At this point, index=3 is not executed with the index++ instruction:

At this point, index=4, the triangle button running above automatically converts to a pause key button, and the program cannot be halted:

And the following are main function and interrupt function codes:

void main(void)
{


WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = ADC12ON+ADC12SHT0_8+ADC12MSC; // Turn on ADC12, set sampling time
// set multiple sample conversion
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_2+ADC12SSEL_0; // Use sampling timer, set mode
ADC12IE = 0x01; // Enable ADC12IFG.0
ADC12CTL0 |= ADC12ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion

__bis_SR_register(LPM4_bits + GIE); // Enter LPM4, Enable interrupts
// For debugger
while(1)
{
if(index==3)
{
f = 1;
index = 0;

for(q4=0;q4<num_point;q4++)
{
Chan_data=results[q4];
//Chan_data -=0x7FF;
Chan_data *=1.5;
result[q4] =((float)Chan_data/4095);
}

fft(result,tab_dftI);
get_power(result,tab_dftI);
sort(tab_power,count_index);

}

}

}


#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
{

switch(__even_in_range(ADC12IV,34))
{
case 0: break; // Vector 0: No interrupt
case 2: break; // Vector 2: ADC overflow
case 4: break; // Vector 4: ADC timing overflow
case 6: // Vector 6: ADC12IFG0

results[index] = ADC12MEM0; // Move results
// Increment results index, modulo; Set Breakpoint1 here
//ADC12IFG0 &= ~BIT0;
if (index == 3)
{
index=0;
ADC12CTL0 &= ~ADC12ENC;
ADC12CTL0 &= ~ADC12ON;
ADC12CTL0 &= ~ADC12SC;

}
index++;
break;// Increment results index, modulo; Set Breakpoint1 here

case 8: break; // Vector 8: ADC12IFG1
case 10: break; // Vector 10: ADC12IFG2
case 12: break; // Vector 12: ADC12IFG3
case 14: break; // Vector 14: ADC12IFG4
case 16: break; // Vector 16: ADC12IFG5
case 18: break; // Vector 18: ADC12IFG6
case 20: break; // Vector 20: ADC12IFG7
case 22: break; // Vector 22: ADC12IFG8
case 24: break; // Vector 24: ADC12IFG9
case 26: break; // Vector 26: ADC12IFG10
case 28: break; // Vector 28: ADC12IFG11
case 30: break; // Vector 30: ADC12IFG12
case 32: break; // Vector 32: ADC12IFG13
case 34: break; // Vector 34: ADC12IFG14
default: break;
}
return;
s}

Could you help check this case? Thanks.

Best Regards,

Cherry

**Attention** This is a public forum