新手上路
- 积分
- 34
- 金钱
- 34
- 注册时间
- 2017-10-31
- 在线时间
- 6 小时
|
1金钱
short Get_Temprate(void)
{
double R_T;
u16 AVC=3300;
u16 R=1000;
u16 k=0;
u32 adcx;
short result;
double temperate;
adcx=T_Get_Adc_Average(ADC_Channel_1,20); //取平均值
temperate=AVC*((float)adcx/1024); //电压值
R_T=(AVC-temperate)*(R/temperate);
if(R_T==RT_50[146])
{
result=-30+146;
}
for(k=0;k<146;k++)
{
if(R_T==RT_50[k])
{
result=-30+k;
}
else if ((R_T<RT_50[k])&&(R_T>RT_50[k+1]))
{
result=-30+k;
}
}
return result;
}
|
最佳答案
查看完整内容[请看2#楼]
你的基准电压不一定是3.3V的,会有偏差,最好的方法就是在电路上消除这种偏差。参考电阻一定要是高精度电阻。图中方法不需要查表,最后得出结果就是温度值。
|