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 and DTC (MSP430 F2xx) - problems in reading analog input on multiple channels

We are trying to read analog voltage supplied to two channels simultaneously using ADC10 and DTC.
We are not getting the results of conversions. Our code is as follows:

 ADC10CTL1 = INCH_2 + CONSEQ_1;

 ADC10CTL0 = REF2_5V + SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE;
 ADC10AE0 |= 0x06;
 ADC10DTC1 = 0x02;
 ADC10SA = 0x200;                        // Data buffer start

  while (1)
  {
        ADC10CTL0 &= ~ENC;
        while (ADC10CTL1 & BUSY);
        ADC10SA = 0x200;
        ADC10CTL0 |= ENC + ADC10SC; //Sampling and conversion start
         __bis_SR_register(CPUOFF + GIE);        // LPM0 with interrupts enabled
    }

and, the ISR is:

#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{ int * read = 0x200;
//code that reads from the location 'read'
  __bic_SR_register_on_exit(LPM3_bits);        // Clear LPM3 bit from 0(SR)
}

While we are getting the results back at AP, they do not show the correct value, and the value doesn't change if the supplied voltage changes.
How do we make sure that an interrupt is generated only when the conversion is complete?

Thanks a lot for your time.

  • Hi,

    the ADC10_VECTOR is the Interrupt Vector for the ADC10. So, why do you use the Timer interrupt? 

    Rgds
    aBUGSworstnightmare 

  • Remionds me of an old movie:

    "She wanted to meet me in front of the library, and now I'm waiting here for hours and she's not showing up" - "this building is not the library, it's the museum" - "Oh, well, then why did she tell me to meet her a the library?"

**Attention** This is a public forum