NTC 热敏电阻温度计算公式
Rt = R EXP(B(1/T1-1/T2))
这里T1和T2指的是K度即开尔文温度,K度=273.15(绝对温度)+摄氏度;其中T2=(273.15+25)
Rt 是热敏电阻在T1温度下的阻值;
R是热敏电阻在T2常温下的标称阻值;
B值是热敏电阻的重要参数;
EXP是e的n次方;
求T1 =ln(Rt/R)/B+1/T2
C程序:
#include “math.h”
const float Rp=10000.0; //10K
const float T2 = (273.15+25.0);;//T2
const float Bx = 3950.0;//B
const float Ka = 273.15;
float Get_Temp(void)
{
float Rt;
float temp;
Rt = Get_TempResistor();
//like this R=5000, T2=273.15+25,B=3470, RT=5000EXP(3470(1/T1-1/(273.15+25)),
temp = Rt/Rp;
temp = log(temp);//ln(Rt/Rp)
temp/=Bx;//ln(Rt/Rp)/B
temp+=(1/T2);
temp = 1/(temp);
temp-=Ka;
return temp;
}
转载:https://www.cnblogs.com/lort/p/5579581.html