code unsigned int adc[]={228,221,213,204,194,183,172,160,147,135,122,110,99,88,78,69,61,54,48,42,38,33,29,26,23,20,18,16,14,13,11 };code unsigned int tem[]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150};code unsigned int xielv[]={71,63,56,50,45,45,42,38,42,38,42,45,45,50,56,63,71,83,83,125,100,125,167,167,167,250,250,250,500,250 };
void temp_tr(){ unsigned char i; for(i=0;i<30;i++) {
if((b>adc[i+1])&&(b<=adc
)) { Temp0=adc-b; Temp1=(xielv)*(Temp0);//这里有时候会出现乱码 if(Temp1==0) { T=tem; } else { T=Temp1/100+tem; } } } if(b<11) { T=0; P2_0=0; P1_0=1; } if(b>228||b==228) { T=0; }
}
b是ad值,0~228之间
此帖出自小平头技术问答
这里已经超范围
一周热门 更多>