程序 如下
const float NTC_25_10K[NTCCount][2]=
{
{-10.0,42.537},{ -9.0,40.642},{ -8.0,38.842},{ -7.0,37.132},{ -6.0,35.506},
{ -5.0,32.146},{ -4.0,32.491},{ -3.0,31.093},{ -2.0,28.248},{ -1.0,28.498},
{ 0.0,27.293},{ 1.0,26.145},{ 2.0,25.052},{ 3.0,24.010},{ 4.0,23.018},
{ 5.0,22.072},{ 6.0,21.169},{ 7.0,20.309},{ 8.0,19.488},{ 9.0,18.705},
{ 10.0,17.957},{ 11.0,17.243},{ 12.0,16.561},{ 13.0,15.910},{ 14.0,15.288},
{ 15.0,14.693},{ 16.0,14.125},{ 17.0,13.582},{ 18.0,13.062},{ 19.0,12.565},
{ 20.0,11.682},{ 21.0,11.634},{ 22.0,11.199},{ 23.0,10.781},{ 24.0,10.382},
{ 25.0,10.000},{ 26.0, 9.633},{ 27.0, 9.282},{ 28.0, 8.945},{ 29.0, 8.622},
{ 30.0, 8.313},{ 31.0, 8.016},{ 32.0, 7.731},{ 33.0, 7.458},{ 34.0, 7.196},
{ 35.0, 6.687},{ 36.0, 6.703},{ 37.0, 6.471},{ 38.0, 6.248},{ 39.0, 6.034},
{ 40.0, 5.828},{ 41.0, 5.631},{ 42.0, 5.441},{ 43.0, 5.258},{ 44.0, 5.083},
{ 45.0, 4.914},{ 46.0, 4.751},{ 47.0, 4.595},{ 48.0, 4.445},{ 49.0, 4.300},
( 50.0, 4.160),( 51.0, 4.026),( 52.0, 3.897),( 53.0, 3.773),( 54.0, 3.653),
( 55.0, 3.538),( 56.0, 3.426),( 57.0, 3.319),( 58.0, 3.216),( 59.0, 3.116)
};
float Get_Temp(float Res)
{
float TheTemp = 0;
unsigned char TheNum = 0;
for(TheNum = 0;TheNumNTC_25_10K[TheNum][1])
{
TheTemp = (Res-NTC_25_10K[TheNum][1])/(NTC_25_10K[TheNum-1][1]-NTC_25_10K[TheNum][1]);
TheTemp = NTC_25_10K[TheNum-1][0] + TheTemp;
return TheTemp;
}
}
return -100.0;
}
这个是在STVD中测试通过
但是IAR 不支持 但是IAR一维表是支持的啊
请教一下 在 IAR中 二维表如何调用 谢谢
|