12345678910111213141516171819202122232425 |
- #include "ntc.h"
- u32 NTC_ADC_VALUE_SUM = 0;
- float Get_Temperature(u16 ADC_VALUE)
- {
- float Rp = 10000.0; //分压电阻
- float Rn = 10000.0; //在TN常温下的标称阻值
- float T2 = (273.15 + 25.0); //开尔文温度,K度=273.15(绝对温度)+摄氏度
- float Bx = 3950.0;
-
- float Rt = 0.0;
- float valta = 0.0;
-
- valta = (float)ADC_VALUE*3.3/4095;
-
- Rt = (Rp*valta)/(3.3-valta);
-
- return (1/( log(Rt/Rn)/Bx+ (1/T2) )) - 273.15;//272.65
- }
|