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 interrupt handler on MSP430F5310

Other Parts Discussed in Thread: MSP430F5310

On the MSP430F5310, I am frantically trying to get the ADC10 to work in the following configuration:

  • Single channel sequence, initiated by SW (i.e. by setting ADC10CTL0 |= ADC10SC) in a timer interrupt function (called every 10 ms)
  • Retrieving the result via the ADC10 interrupt routine

I´ve got the 48-pin variant, this means that only A0 to A3, A8 and A9 are available. I want to read A0...A3. Unfortunately, I only can read A1 and A3, for the other ones I never receive any value.

Here´s my code (at least the relevant parts):

Initialization (called once):

P6SEL = 0xFF;
P6DIR = 0x00;
P6REN = 0x00;

  ADC10CTL1 = ADC10CONSEQ_1 + ADC10SSEL_2 + ADC10DIV_0 + ADC10SHS_0 + ADC10SHP;
  ADC10CTL2 = ADC10RES;
  ADC10MCTL0 = ADC10INCH_3;
 
  ADC10IE = ADC10IE0;
  ADC10CTL0 |= ADC10ENC + ADC10ON;

Timer routine (called every 10 ms, this works properly):

    ADC10CTL0 |= ADC10SC;

ISR for the ADC10:

#pragma vector=ADC10_VECTOR
__interrupt void adc10_isr(void) {
    int reg;

P2OUT ^= 1;    
    if (ADC10IFG & ADC10IFG0) {
    
      reg = ADC10MCTL0 & 0x0F; // ADC channel
    
      check[reg]++;
    
      dataout[reg] = ADC10MEM0;

    }
    ADC10IV = 0; // reset IV

}

dataout[] is an int array meant to store the latest values, check[] is another one to find out how often the ISR is called for which channel. In my understanding, the ISR is called once after each conversion for each of the channels, so check[] should have four identical values in a row.

What I find, however, is that the ISR is called only with ADC10MCTL0 values leading to reg = 2 or reg = 4, i.e. check[] = { 0 value 0 value 0 0 0 ... }.

Playing around with the ADC10MCTL0 values (and changing them to some ADC10INCH_x) did not help. I am now definitely beyond my wisdom. Has someone any suggestion?

There´s plenty of code to ADC12, and lots of code for the MSP430F2xxx, but apparently next to none for what I need.

Thank you,

Max

 

**Attention** This is a public forum