//***************************************************************************//
// //
// Init_ADC_seq(void): 初始化ADC端口,选用A0、A7口序列通道单次扫描 //
// //
//***************************************************************************//
void Init_ADC_seq(void)
{
P6SEL = 0x81; // Enable A/D channel A0/A7
ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; // Turn on ADC12, set sampling time
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1+ADC12SSEL1 ; // Use sampling timer, single sequence
// ADCCLK=MCLK,NO DIV
ADC12MCTL0 = ADC12INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = ADC12INCH_7+ADC12EOS; // ref+=AVcc, channel = A1
= A3, end seq.
ADC12IE = 0x02; // Enable ADC12IFG.1
ADC12CTL0 |= ADC12ENC; // Enable conversions
}
代码在我把A0/A7都接上固定电平的时候,一直正常(T>=720h);
只是后来单把A7拉出来悬空,看测试数据时才发现这现象 |