for (;;)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY); // Wait if ADC10 core is active
ADC10SA = 0x200; // Data buffer start
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion ready
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
_NOP(); // space for debugger
_NOP(); // Set Breakpoint here to read ADC
}
}
// ADC10 interrupt service routine
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void)
{
__bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR)
a0=*(unsigned int *)0x200;//A1通道的转换结果,注意此处的0x200要与ADC10SA的值一致
a1=*(unsigned int *)0x202;//A0通道的转换结果,注意ADC10是先转换高通道再转换多通道
}