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.

CCS/MSP430G2755: ADC10 results are fluctuating a lot :(

Part Number: MSP430G2755

Tool/software: Code Composer Studio

Hi,

I'm using the ADC10 to read voltage measures using the internal 2.5V reference voltage.

I also have it set up so the LED would turn on when the reading is below some number.

I was testing it and getting really noisy data, so I tried setting up the LED so it would turn on when 0V and connected the input pin to GND.

But the LED is still blinking a lot (which means it's not reading 0V at GND?). Is ADC10 supposed to be this unreliable? or am I doing something wrong with the set up?

I have all the clocks to be the longest so it has more time to average out if needed (ADC10SHT_3 and ADC10DIV_0)

Here is a bit of my code with the set up of ADC and the LED:

// Vref+ and Vss, sample-hold time = 64*tADC10CLKS, turn on adc and vref
ADC10CTL0 |= SREF_1 | ADC10SHT_3 | REFON |REF2_5V | ADC10ON;


// Temp Sensor ADC10CLK = ACLK/1, single conversion mode
ADC10CTL1 = INCH_0 | ADC10DIV_0 | ADC10SSEL_1 | CONSEQ_0;

// Need to wait 30us before Vref is settled correctly
__delay_cycles(480);


ADC10CTL0 |= ENC | ADC10SC; // Sampling and conversion start

uint16_t temp;
ADC10CTL0 &= ~ADC10IFG;
temp = ADC10MEM;

if(temp<=0) // LED on when temp (voltage) is 0 or lower
{
vbat_low = true;
P1OUT |= 0x01; // Set P1.0 LED on
}
else
{
vbat_low = false;
P1OUT &= ~0x01; // Clear P1.0 LED off
}

ADC10CTL0 &= ~ENC;

I have a lot more of other stuff going on besides this but this should be the only part related to the adc operation.

Did anyone else also have ADC10 accuracy issues? 

When it's connected to GND, I've seen it jump by 10 (in decimal) out of 2^10=1024, of ADC10MEM, which translates into .008V of an error when using 2.5V ref. And this is when I've connected this pin directly to GND. When I'm observing the LED with my eyes, it turns off and back on (glitching from 0V) about 3 times per second. Is this expected behavior?

Thanks!

**Attention** This is a public forum