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.

MSP430FR2433: Read ADC conversion result

Part Number: MSP430FR2433

Hi

I am working on a project that I need to collect all the ADC conversion results, the exact code is shown below

#include <msp430.h>

unsigned int ADC_Result;

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

// Configure GPIO
P1DIR |= BIT0; // Set P1.0/LED to output direction
P1OUT &= ~BIT0; // P1.0 LED off

// Configure ADC A1 pin
SYSCFG2 |= ADCPCTL1;

// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;

// Configure ADC10
ADCCTL0 |= ADCSHT_2 | ADCON; // ADCON, S&H=16 ADC clks
ADCCTL1 |= ADCSHP; // ADCCLK = MODOSC; sampling timer
ADCCTL2 |= ADCRES; // 10-bit conversion results
ADCIE |= ADCIE0; // Enable ADC conv complete interrupt
ADCMCTL0 |= ADCINCH_1 | ADCSREF_1; // A1 ADC input select; Vref=1.5V

// Configure reference
PMMCTL0_H = PMMPW_H; // Unlock the PMM registers
PMMCTL2 |= INTREFEN; // Enable internal reference
__delay_cycles(400); // Delay for reference settling

while(1)
{
ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start
__bis_SR_register(LPM0_bits | GIE); // LPM0, ADC_ISR will force exit
if (ADC_Result < 0x155)
P1OUT &= ~BIT0; // Clear P1.0 LED off
else
P1OUT |= BIT0; // Set P1.0 LED on
__delay_cycles(5000);
}
}

// ADC interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC_VECTOR
__interrupt void ADC_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC_VECTOR))) ADC_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(ADCIV,ADCIV_ADCIFG))
{
case ADCIV_NONE:
break;
case ADCIV_ADCOVIFG:
break;
case ADCIV_ADCTOVIFG:
break;
case ADCIV_ADCHIIFG:
break;
case ADCIV_ADCLOIFG:
break;
case ADCIV_ADCINIFG:
break;
case ADCIV_ADCIFG:
ADC_Result = ADCMEM0;
__bic_SR_register_on_exit(LPM0_bits); // Clear CPUOFF bit from LPM0
break;
default:
break;
}
}

I am trying to read the value of ADC_Result and I added it to the watch window and set a breakpoint here. I also set the breakpoint property to 'Refresh all windows' so that I can get a constant change view of the data. However, even when I put a long-period signal wave in I can only get approximately 15 samples per period which means the sampling frequency is extremely low. I confirm that the whole sample and conversion process takes really short time like 50us so I dont know what is the problem with it. 

**Attention** This is a public forum