大虾: 本人在使用下面的代码进行AD的时候,发现数据很不稳定 unsigned short int read_channel(unsigned char channel) { unsigned short int temp; //discharge(); ADCCON = 0x6E4; //Continuous software conversion. temp = 0xffff; ADC.dd[1] = 0x00; ADCCP = channel; my_delay(1); while (ADC.dd[1]!=temp) { ADCCP = channel; temp = ADC.dd[1]; while (!ADCSTA); // wait for end of conversion ADC.data = ADCDAT; } return(ADC.dd[1]); } 希望大虾能够帮忙分析原因。 |