This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AD采集



大家好!

        我在做AD采集引脚电压时遇到问题,我的代码如下,但是采集的电压是错误的,求指正,谢谢!

      ADCH   &= 0X00;  //清EOC标志 
     APCFG|=0x80;
     ADCCFG |= 0X80;
     ADCCON3 = 0xb7;  //单次转换,参考电压为电源电压,对P07进行采样      //12位分辨率
     ADCCON1 = 0X30;  //停止A/D
     ADCCON1|= 0X40;         //启动A/D

 while(!(ADCCON1&0x80));
        
                         temp[1] = ADCL;
                        temp[0] = ADCH;
                        adc  = (uint)temp[1]>>2;
                        adc |= ( (uint) temp[0] )<<6;                                            
                        num = (adc*3.3)/4096;

另外:在各分辨率下公式是怎样确定的?ADCL和ADCH在各个分辨率下有效位怎么取?