Converts the output from a Texas Instruments LMT70 temperature sensor (in mV) to degrees C

Files at this revision

API Documentation at this revision

Comitter:
adamsona
Date:
Thu Oct 22 16:58:50 2015 +0000
Commit message:
Initial release.

Changed in this revision

convert_lmt70.cpp Show annotated file Show diff for this revision Revisions of this file
convert_lmt70.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convert_lmt70.cpp	Thu Oct 22 16:58:50 2015 +0000
@@ -0,0 +1,15 @@
+#include "convert_lmt70.h"
+
+/*  Converts voltage output from Texas Instruments LMT70 temp sensor into degrees C
+  using the 3rd-order lookup table that's a best fit for the full range of -55C - 150C
+  found at http://www.ti.com/lit/ds/symlink/lmt70.pdf
+*/
+float convert_lmt70 (float mV) {
+    float a, b, c, d;
+    a = -1.064200E-09;
+    b = -5.759725E-06;
+    c = -1.789883E-01;
+    d = 2.048570E+02;
+
+    return a*mV*mV*mV + b* mV*mV + c*mV + d;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convert_lmt70.h	Thu Oct 22 16:58:50 2015 +0000
@@ -0,0 +1,6 @@
+#ifndef MBED_LMT70_H
+#define MBED_LMT70_H
+ 
+#include "mbed.h"
+float convert_lmt70(float mV);
+#endif
\ No newline at end of file