ntc.c 337 B

123456789101112131415161718192021222324
  1. #include "ntc.h"
  2. u32 NTC_ADC_VALUE_SUM = 0;
  3. float Get_Temperature(u16 ADC_VALUE)
  4. {
  5. float Rp = 100000.0;
  6. float T2 = (273.15 + 25.0);
  7. float Bx = 3950.0;
  8. float Ka = 273.15;
  9. float Rt = 0.0;
  10. float valta = 0.0;
  11. valta = ADC_VALUE*3.3/4095;
  12. Rt = (Rp*valta)/(3.3-valta);
  13. return (1/( ( log(Rt/Rp) )/Bx+ (1/T2) )) - 272.65;
  14. }