Converts the output from a Texas Instruments LMT70 temperature sensor (in mV) to degrees C
convert_lmt70.cpp@0:2cbfc517b1c4, 2015-10-22 (annotated)
- Committer:
- adamsona
- Date:
- Thu Oct 22 16:58:50 2015 +0000
- Revision:
- 0:2cbfc517b1c4
Initial release.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adamsona | 0:2cbfc517b1c4 | 1 | #include "convert_lmt70.h" |
adamsona | 0:2cbfc517b1c4 | 2 | |
adamsona | 0:2cbfc517b1c4 | 3 | /* Converts voltage output from Texas Instruments LMT70 temp sensor into degrees C |
adamsona | 0:2cbfc517b1c4 | 4 | using the 3rd-order lookup table that's a best fit for the full range of -55C - 150C |
adamsona | 0:2cbfc517b1c4 | 5 | found at http://www.ti.com/lit/ds/symlink/lmt70.pdf |
adamsona | 0:2cbfc517b1c4 | 6 | */ |
adamsona | 0:2cbfc517b1c4 | 7 | float convert_lmt70 (float mV) { |
adamsona | 0:2cbfc517b1c4 | 8 | float a, b, c, d; |
adamsona | 0:2cbfc517b1c4 | 9 | a = -1.064200E-09; |
adamsona | 0:2cbfc517b1c4 | 10 | b = -5.759725E-06; |
adamsona | 0:2cbfc517b1c4 | 11 | c = -1.789883E-01; |
adamsona | 0:2cbfc517b1c4 | 12 | d = 2.048570E+02; |
adamsona | 0:2cbfc517b1c4 | 13 | |
adamsona | 0:2cbfc517b1c4 | 14 | return a*mV*mV*mV + b* mV*mV + c*mV + d; |
adamsona | 0:2cbfc517b1c4 | 15 | } |