求解。
用430内部ad12采样信号,如果在输入短路感觉挺好的,为什么有信号输入就不稳定呢?我只能通过使用很多的采集做平均来弥补,速度太慢了。请求高手解答。
P6SEL |= 0xFF; // Enable A/D channel A0
P6DIR &= 0x00;
REFCTL0 |= REFMSTR + REFVSEL_2 + REFON;
/* Initialize ADC12_A */
ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_2; // Turn on ADC12, set sampling time
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1; // Use sampling timer, single sequence
ADC12MCTL0 = ADC12SREF_1+ADC12INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = ADC12SREF_1+ADC12INCH_1; // ref+=AVcc, channel = A1
ADC12MCTL2 = ADC12SREF_1+ADC12INCH_2; // ref+=AVcc, channel = A1
ADC12MCTL3 = ADC12SREF_1+ADC12INCH_3; // ref+=AVcc, channel = A1
ADC12MCTL4 = ADC12SREF_1+ADC12INCH_4; // ref+=AVcc, channel = A1
ADC12MCTL5 = ADC12SREF_1+ADC12INCH_5; // ref+=AVcc, channel = A1
ADC12MCTL6 = ADC12SREF_1+ADC12INCH_6; // ref+=AVcc, channel = A1
ADC12MCTL7 = ADC12SREF_1+ADC12INCH_7+ADC12EOS; // ref+=AVcc, channel = A1
ADC12CTL0 |= ADC12ENC; // Enable conversions
delay_us(100);
此帖出自
小平头技术问答
一周热门 更多>