9# mmax
谢谢,循环里面的判断总是NTCTAB[M]<ADC_TEMP ,当NTCTAB[M]>ADC_TEMP也是执行if(NTCTAB[M]<ADC_TEMP) CHBSTART=M;
找不出原因,糊涂中。。。
code unsigned char NTCTAB[100] = {
150,156,163,169,176,183,190,198,216,214,//0-9
222,231,240,249,258,268,277,287,297,307,//10-19
317,327,337,347,357,368,378,388,398,408,//20-29
418,429,439,450,460,471,482,493,505,516,//30-39
526,537,548,558,568,577,586,596,605,615,//40-49
624,633,642,652,660,669,678,686,695,703,//50-59
711,718,726,734,741,749,756,764,771,778,//60-69
784,791,797,803,809,814,819,824,829,833,//70-79
838,843,847,852,856,860,865,869,873,877,//80-89
882,885,888,891,894,898,901,905,908,911 //90-99
};//5.6k
// while (!(ADC_CONTR & ADC_FLAG));//Wait complete flag
// ADC_CONTR &= ~ADC_FLAG; //Close ADC
// ADC_TEMP = ((ADC_DATA<<2)|(ADC_LOW2&0x03));
ADC_TEMP=901;
for(i=0;i<7;i++) //搜索全表
{
M=CHBSTART+(BYTE)(CHBEND-CHBSTART)/2;
if(NTCTAB[M]<ADC_TEMP) CHBSTART=M;
else if(NTCTAB[M]>ADC_TEMP) CHBEND=M;
else //查到相等的节点
CONTER3=M;
}
DISDGUF[4]=CONTER3/10;
DISDGUF[5]=CONTER3%10; |