本帖最后由 aa911 于 2019-2-17 22:37 编辑
N76E003采集热敏电阻AD值超出4095,如何处理.热敏电阻阻值10K,分压电阻1K。unsigned long GetResult(void)
{
clr_ADCF;
set_ADCS;
while(ADCF == 0);
temp_H=ADCRH;
temp_L=ADCRL;
ADCtemp=((temp_H<<4)|(temp_L&0x0F));
return ADCtemp;
}
void ntc_ADC()
{
P12 = 0;
Enable_ADC_AIN0; //PIN14
Timer0_Delay1ms(100);
data1 = GetResult();
Timer0_Delay1ms(100);
data1 = GetResult();
printf ("\n ntc = %d", data1);
|