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.

ADC10 Problem

Hi all. I've got a problem with the ADC. I'm running the DCO at 16MHz, and setting the SMClk at this same frequency. 

The signal I want to sample has a frequency of 33kHz, and the setting for the ADC10 are

void ConfigADC10(void){
ADC10CTL1 = INCH_5 + ADC10SSEL_3; // Channel 5, Elijo SMCLK
ADC10CTL0 = SREF_1 + REFON + REF2_5V + ADC10SHT_0 + ADC10ON + ADC10IE; //2.5V & Vss as reference, 4 clk times
ADC10AE0 |= BIT5; //P1.5 ADC option
}

The part where I am sampling is 

case 3:{
TACCR0 += 60;
estado = 0;
flag = 1;
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
valorPixel = ADC10MEM;
break;
}

The problem is the values I'm sampling are between 0040 and 0180, when I am sampling a signal that goes between 0,4 and 2,8V... , so I expect to get values between  0163 and 1023. 

What could the problem be?  Thank you in advance for your help. 

  • 1) You didn't say which MSP you'r eusing, so I don't know whether you actually have an ADC10 or ADC10_A. All I can say is that it isn't an 1x family device as these are limited to 8MHz.

    2) after switching the reference on, it requires some time to settle. All readings before the referene has settles are unreliable. See the device datasheet for timing details.

    3) when you start a conversion, it takes some time to complete. But you read AC10MEM immediately after you started the conversion. You need to wait until the conversion is done.

    4) you set ADC10IE. This means that when the conversion is done, an interrup tis triggered to the ADC10_VECTOR ISR. But you don't have an ISR, so your MSP will crash, reset or otherwise behave erroneously when the conversion is actually done.

    5) you set ADC10SHT_0, which selects the shortest possible sampling time. maybe too short for reliable results, depending on signal output impedance.

    6) if you have ADC10_A, then you need to set the ADC10SHP bit in order to make ADC10SHTx work at all.

**Attention** This is a public forum