#include "ntc.h" u32 NTC_ADC_VALUE_SUM = 0; float Get_Temperature(u16 ADC_VALUE) { float Rp = 10000.0; float T2 = (273.15 + 25.0); float Bx = 3950.0; //float Ka = 273.15; float Rt = 0.0; float valta = 0.0; float R = 10000.0; float Tmotor = 0.0; valta = ADC_VALUE*3.3/4095; Rt = (R*valta)/(3.3-valta); if(Rt>32116){ Tmotor = 0; } else if(Rt>15652){ Tmotor = -0.901*Rt/1000 + 28.381; }else if(Rt>6523){ Tmotor = -2.5013*Rt/1000 + 50.657; }else if(Rt>2968){ Tmotor = -6.3342*Rt/1000 + 73.203; }else if(Rt>1228){ Tmotor = -16.002*Rt/1000 + 98.576; }else if(Rt > 657){ Tmotor = -38.551*Rt/1000 + 124.83; }else if(Rt > 324){ Tmotor = -81.812*Rt/1000 + 150.67; }else{ Tmotor = 125; } return Tmotor; //return (1/( ( log(Rt/Rp) )/Bx+ (1/T2) )) - 272.65; }