用pt100吧,这个器件的线性很好
以下代码是我拟合了PT100,cu50,BA1,BA2的曲线,你可以参考使用。
- _Data_Ch Data_Ch[4]=
- {
- {{-2.194e-11,2.349e-8,-8.453e-6,0.002422,2.245,-242.5},5,PT100,},
- {{0.0001619,4.648,-232.7},2,CU50,},
- {{-4.31e-9,1.825e-6,-0.0002766,0.02346,4.486,-236.5},5,BA1,},
- //{{-7.958e-11,3.256e-08,-4.766e-06,0.0002932,-0.0009193,4.955,-239.5},6,BA1,},
- {{-3.406e-11,3.345e-08,-1.145e-05,0.002776,2.194,-238.7},5,BA2,},
- };
- float jisuan(_InputType type,float val)
- {
- float d=0;
- uint8_t i,j;
- for(i=0;i<10;i++)
- {
- if(Data_Ch[i].type==type)
- break;
- }
-
- for(j=0;j<=Data_Ch[i].cishu;j++)
- d+=Data_Ch[i].Confing[j]*pow(val,Data_Ch[i].cishu-j);
- return d;
- }
复制代码 |