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.

MSP430G2553: continuous ADC10 sampling (with interrupt)

Part Number: MSP430G2553
Other Parts Discussed in Thread: MSP-FET
#include <msp430g2553.h>

/**
 * main.c
 * Use ADC module to read the value of the MCU's internal temperature sensor
 * and dump those values into an array.
 */

volatile unsigned counter = 0;
volatile unsigned temparr[20];

void main(void)
{
    WDTCTL = WDTPW + WDTHOLD;                                           // Stop WDT

    ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + MSC;  // Set ADC module
    ADC10CTL1 = CONSEQ_2 + INCH_10 + ADC10DIV_7;                        // Set ADC module
    ADC10DTC0 = ADC10CT;                                                // Set ADC module

    ADC10CTL0 |= ENC + ADC10SC;

    __enable_interrupt();

}

#pragma vector=ADC10_VECTOR
__interrupt void ADC10_IRS(void)
{
    //while (ADC10CTL1 & BUSY);                                           // Give time to the ADC to settle

    if (counter < 20) {
        temparr[counter] = ADC10MEM;
        counter++;
    }

    else {
        counter = 0;
        ADC10CTL0 &= ~(ENC + ADC10SC);
    }
}


I wrote a small program to continuously sample the internal temperature sensor of the MSP430G2553 based on the ADC10 interrupt. My code, however, does not do that. It triggers the interrupt (only) once, it populates the first index of the array,  and then it stops. What am I missing? Thanks.

**Attention** This is a public forum