Other Parts Discussed in Thread: MSP430F5528
Hi,
I am currently using an MSP430F5528. I have 2 ADCs enabled and I am trying to read both at the same time. The problem is that I need to send 2 requests to get the ADC values. I believe that the interrupt does not get called. Do you have any ideas why this might be?
Here is the code to initialize the ADC
void ADC_Init(void)
{
P6SEL = 0x11; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; // Turn on ADC12, set sampling time
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1; // Use sampling timer, single sequence
ADC12MCTL0 = ADC12INCH_0+ADC12SREF_1; // ref+=AVcc, channel = A0
ADC12MCTL4 = ADC12INCH_4+ADC12SREF_1+ADC12EOS; // ref+=AVcc, channel = A3, end seq.
ADC12IE = 0x10; // Enable ADC12IFG.3
ADC12CTL0 |= ADC12ENC; // Enable conversions
}
The ISR is:
#pragma vector = ADC12_VECTOR
__interrupt void ADC12_ISR(void)
{
switch(__even_in_range(ADC12IV,34))
{
case 0: break; // Vector 0: No interrupt
case 2: break; // Vector 2: ADC overflow
case 4: break; // Vector 4: ADC timing overflow
case 6: // Vector 6: ADC12IFG0
//ADC_Result1 = ADC12MEM0; //store the temperature
// ADC_done_flag=1;
break;
case 8: break; // Vector 8: ADC12IFG1
case 10: break; // Vector 10: ADC12IFG2
case 12: break; // Vector 12: ADC12IFG3
case 14: // Vector 14: ADC12IFG4
ADC_Result1 = ADC12MEM0; //store the temperature
ADC_Result2 = ADC12MEM4; //store the temperature
ADC_done_flag=1;
break;
case 16: break; // Vector 16: ADC12IFG5
case 18: break; // Vector 18: ADC12IFG6
case 20: break; // Vector 20: ADC12IFG7
case 22: break; // Vector 22: ADC12IFG8
case 24: break; // Vector 24: ADC12IFG9
case 26: break; // Vector 26: ADC12IFG10
case 28: break; // Vector 28: ADC12IFG11
case 30: break; // Vector 30: ADC12IFG12
case 32: break; // Vector 32: ADC12IFG13
case 34: break; // Vector 34: ADC12IFG14
default: break;
}
}
and I start the conversion by doing:
ADC12CTL0 |= ADC12SC; // Sampling and conversion start
One fix is to call the conversion two times one right after another, but I want to know if I am doing something wrong. (when I had only one enabled it worked fine)
Thank you.
Alin