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.

MSP430F133: Multi-channel ADC reference problem?

Part Number: MSP430F133

Hello,

I've got an application reading 2 channels in a single shot multiple channel ADC read.  The code is below.  It seems to "work" but the actual reading I am getting from the first temporal channel sampled is high.  I am sampling 2 input channels  which are approximately 2.5v.   they should both be referencing Vcc which is 3.3V.  The first channel gives me just over 3700 ADC counts while the second channel gives me what I would expect, about 3100 counts.  When I switch the input channels (swap INCH_0 and INCH_1)  in the Init_ADC function, the first channel sampled (ADC12MEM0) is still high around 3700 while the second channel is correct.  

Any thoughts on this would be appreciated.

Thanks,   Dave

void Init_ADC()
{
P6SEL |= 0x03; // P6.0 & P6.1 ADC option select
ADC12CTL0 = SHT0_2 + MSC + ADC12ON; // Set sampling time, Multiple sample conversion, turn on ADC12
ADC12CTL1 = SHP + CONSEQ_1; // Use sampling timer, convert sequence once
ADC12MCTL0 = INCH_0; // ref+=AVcc, channel = A0 TEMP
ADC12MCTL1 = INCH_1 + EOS; // ref+=AVcc, channel = A1 SENSE
ADC12IE = 0x02; // Enable interrupt on 2nd channel - end of sequence
ADC12CTL0 |= ENC; // Conversion enabled
}

void Start_ADC()
{

ADCDoneFlag=0;

ADC12IE = 0x02; // Enable interrupt
ADC12CTL0 |= ADC12SC; // Sampling start
ADCStartFlag=0;
}

// ADC12 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC12_VECTOR
__interrupt void ADC12_ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12_ISR (void)
#else
#error Compiler not supported!
#endif
{
ADC12CTL0 &= ~ADC12SC; // Sampling stop
ADC12IE = 0; // disable interrupt

ADC_Value = ADC12MEM1;
ADC_Temp_Value = ADC12MEM0;
ADCDoneFlag=1;

__bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR)
}

  • Source impedance could affect ADC readings (refer to Users Guide, ADC sample time considerations chapter). Reference needs some time to settle (refer to datasheet, reference figures). Add delay after reference enable, increase sampling time, see if it changes result.

**Attention** This is a public forum