|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <math.h>
extern float coldTemper;
float k_thermocoupleCalculate(void)
{
float cold = coldTemper; //冷端温度
float e =12.5; // [mV] cold junction equivalent thermocouple voltage 冷端温度的电压
const static float a[] = { // 0 .. 1372 degC
-0.176004136860E-01, 0.389212049750E-01, 0.185587700320E-04, -0.994575928740E-07,
0.318409457190E-09, -0.560728448890E-12, 0.560750590590E-15, -0.320207200030E-18,
0.971511471520E-22, -0.121047212750E-25,
};
const static float c[] = {
0.118597600000E+00,
-0.118343200000E-03,
0.126968600000E+03,
};
for (int i = 0; i < 9; i++)
{
e += a[i] * pow(cold, i);
}
e += c[0] * exp(c[1] * (cold - c[2]) * (cold - c[2]));
return e;
}
引用的函数
float coldTemper;
float E;
extern float k_thermocoupleCalculate(void);
else if (_200ms_cnt %5 ==4) // 测冷端温度
{
coldTemper= get_18B20();
float E=k_thermocoupleCalculate();//E是冷端电压
}
设e=12.5的时候E=0,e=12.0的时候E=12 这是为啥啊 |
|