ZIP软件篇PT100、NTC等温度传感器阻值-温度换算模块qq_411248012.31KB需要积分:1立即下载资源文件列表: Rtd_Driver.zip 大约有4个文件 Rtd_Driver/Rtd_Driver.c 2.13KB Rtd_Driver/Rtd_Driver.h 2.31KB Rtd_Driver/TypeDef.h 1.79KB Rtd_Driver/ 资源介绍: 软件篇PT100、NTC等温度传感器阻值-温度换算模块 /********************************************************************************* * 文 件 名:Rtd_Driver.c * *------文件信息----------------------------------------- * 程序功能: 温度传感器采集模块 * *------版本历史----------------------------------------- * 创 建 人: 剑胆琴心 * 创建时间: 2024.08.28 * 版 本: V1.00 * 修 改 人: * 修改时间: * 修改说明: *********************************************************************************/ #define Rtd_Driver_GLOBALS /********************************************************************************* * 包含文件 *********************************************************************************/ #include "Include_All.h" /* ----------------------------------接口函数---------------------------------- */ /* NTC阻值转换为温度值 */ float Res2Temp(float RES) { int end = RES_MAX - 1;/* 数组下标最后一个数 */ int front = 0;/* 数组第一个数 */ int half = 0; float temp; if((RES <= RTD_RES_TAB[0]) && (RES >= RTD_RES_TAB[RES_MAX - 1])) { for(half = RES_MAX / 2; end - front !=1;) { if (RES > RTD_RES_TAB[half]) { end = half; half = (end + front) / 2; } else if (RES < RTD_RES_TAB[half]) { front = half; half = (front + end) / 2; } else { front = half; end = half; break; } } if(front == end) { temp = front; } else { temp = (RTD_RES_TAB[front] - RES) / (RTD_RES_TAB[front] - RTD_RES_TAB[end]) * RTD_TEMP_STEP + front;/* 线性计算 */ } } else { temp =-100; } return temp;/* 返回温度值 */ } /* ----------------------------------驱动函数---------------------------------- */ /********************************************************************************* * 文件结束 *********************************************************************************/