code:
void AdcInit(void)
{
ADC12CTL0 = ADC12SHT02 + ADC12ON; // Sampling time, ADC12 on
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL0 = ADC12INCH_2; // select input channel 2
ADC12MCTL1 = ADC12INCH_3 | ADC12EOS; // select input channel 3
ADC12IE = ADC12IE0; // Enable interrupt
ADC12CTL0 |= ADC12ENC;
P6SEL |= BIT2 | BIT3; // P6.0 ADC option select
}
#pragma vector = ADC12_VECTOR
__interrupt void ADC12_ISR(void)
{
uint16 nTemp;
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
nTemp = ADC12MEM0;
TraceLog("ADC12MEM0 = %d\n", nTemp);
nTemp = ADC12MEM1;
TraceLog("ADC12MEM1 = %d\n", nTemp);
__bic_SR_register_on_exit(LPM0_bits); // Exit active CPU
break;
case 8: // Vector 8: ADC12IFG1
break;
default: break;
}
}
p6.2 is successed, but P6,3 is failed ADC12MEM1is zero. but P6.3 voltage is 3.3V