Now supports DS18B20 and DS18S20 Maxim/Dallas one-wire thermometer devices. Also supports DS18S20 in 9, 10, 11, and 12 bit resolution modes. 'Use Address' mode now checks if the correct device type is present, and informs the user which device to use. Correct temperature conversion times now used in non-parasitic mode. The device should be placed at least 6 inches (15 cm) from the mbed board in order to accurately read ambient temperature.

Dependencies:   mbed

Fork of OneWireCRC by Petras Saduikis

Revision:
1:a6643ebd84ec
Parent:
0:01a6a40578c9
--- a/DS18B20.cpp	Sun Jan 03 11:57:31 2010 +0000
+++ b/DS18B20.cpp	Thu Oct 15 23:46:29 2015 +0000
@@ -21,9 +21,9 @@
 */
 
 #include "DS18B20.h"
-#include "DebugTrace.h"
+//#include "DebugTrace.h"
 
-DebugTrace pc_ds18B20(ON, TO_SERIAL);
+//DebugTrace pc_ds18B20(ON, TO_SERIAL);
 
 DS18B20::DS18B20(bool crcOn, bool useAddr, bool parasitic, PinName pin) : 
     OneWireThermometer(crcOn, useAddr, parasitic, pin, DS18B20_ID)
@@ -81,23 +81,23 @@
     {
         case nineBit:    // 0.5 deg C increments
             read_temp &= 0xFFF8;                // bits 2,1,0 are undefined
-             pc_ds18B20.traceOut("9 bit resolution ...\r\n");
+             //pc_ds18B20.traceOut("9 bit resolution ...\r\n");
             break;
         case tenBit:     // 0.25 deg C increments
             read_temp &= 0xFFFC;                // bits 1,0 are undefined
-            pc_ds18B20.traceOut("10 bit resolution ...\r\n");
+            //pc_ds18B20.traceOut("10 bit resolution ...\r\n");
             break;
         case elevenBit:  // 0.125 deg C increments
             read_temp &= 0xFFFE;                // bit 0 is undefined
-            pc_ds18B20.traceOut("11 bit resolution ...\r\n");
+            //pc_ds18B20.traceOut("11 bit resolution ...\r\n");
             break;
         case twelveBit:  // 0.0625 deg C increments
-            pc_ds18B20.traceOut("12 bit resolution ...\r\n");
+            //pc_ds18B20.traceOut("12 bit resolution ...\r\n");
             break;
     }
     float realTemp = (float)read_temp/16 ;
                  
-    pc_ds18B20.traceOut("TEMP_READ/REAL TEMP: %f \r\n", realTemp); 
+    //pc_ds18B20.traceOut("TEMP_READ/REAL TEMP: %f \r\n", realTemp); 
                
     return realTemp;
 }
\ No newline at end of file