Example source code for Maxim Integrated MAX6605 low-power, inexpensive analog output temperature sensor using the MAX32630FTHR analog input. The MAX6605 precision, low-power, inexpensive, analog output temperature sensor is available in a 5-pin SC70 package. The device has a +2.7V to +5.5V supply voltage range and 10µA supply current over the -55°C to +125°C temperature range.

Dependencies:   max32630fthr USBDevice

Revision:
1:9b9c2989d4eb
Parent:
0:a9f350f894e7
Child:
2:9ceed197ca58
--- a/main.cpp	Mon Apr 22 21:23:39 2019 +0000
+++ b/main.cpp	Tue Apr 23 04:34:36 2019 +0000
@@ -28,6 +28,12 @@
     temp_f = ((temp_c * 9)/5) + 32;
     return temp_f;
 }
+
+void max6613_timer(void) {
+        gLED = !gLED;  /* blink the green LED */
+}
+
+
 // main() runs in its own thread in the OS
 // (note the calls to Thread::wait below for delays)
 /**
@@ -35,6 +41,15 @@
 * @version 1.0000.0000
 *
 * @details Sample main program for MAX6613
+* The MAX6613 is a low-cost, low-power analog output (1 wire, plus power)
+* temperature sensor in a tiny 5-pin SC70 package (0.65 mm pitch)
+* Supply Current: 7.5µA typical
+* Supply voltage: 1.8V to 5.5V
+* Operating Range: -55°C to +130°C when VDD is 2.5V to 5.5V
+*                   25°C to +130°C when VDD is 1.8V
+* Accuracy: +-4°C
+* Pin Compatible with LM20
+*
 * The prints are sent to the terminal window (9600, 8n1).
 * The program sets the GPIOs to 3.3V and the program
 * configures the chip and reads temperatures.
@@ -54,12 +69,17 @@
     float c2;
     microUSB.printf("micro USB serial port\r\n");
     rLED = LED_OFF;
-    gLED = LED_ON;
+    gLED = LED_OFF;
     bLED = LED_OFF;
+    Ticker ticker;   // calls a callback repeatedly with a timeout
+    ticker.attach(callback(&max6613_timer), 1.0f);  /* set timer for one second */
 
-    rLED = LED_OFF;
+    daplink.printf("MAX6613 Temperature Sensor\r\n\r\n");
+
     temperature = (float)((1.8455f - (AIN5_FSV * ain1)) / 0.01123f);
-//    daplink.printf("AIN1: %1.5f\n", (AIN5_FSV * ain1) );  // analog inputs 1
+#if 0
+    daplink.printf("AIN1: %1.5f\n", (AIN5_FSV * ain1) );  // analog inputs 1
+#endif
 
     daplink.printf("Temperature using Linear Approximation\r\n");
     for (i = 0; i < 8; i++) {
@@ -76,12 +96,9 @@
         daplink.printf("temperature: %3.1f degrees C C, %3.1f degrees F\r\n", temperature, max6613_celsius_to_fahrenheit(temperature));
         wait(2);
     }
-
-    daplink.printf("\r\n");
+    daplink.printf("\r\n\r\n");
 
     while(1) {
-        gLED = !gLED;
-        wait(0.5);
     }
 }