Version of Richard Lane's library, with #define CABLE_EXT_DELAYS to extend reset() settling delays for extension cable

Fork of DS18B20_1wire by Richard Lane

Files at this revision

API Documentation at this revision

Comitter:
Michael_embed1
Date:
Thu Mar 27 22:50:08 2014 +0000
Parent:
2:b07b40825282
Commit message:
Updated 1-wire bit delays to accommodate higher parasitic cable capacitance. No #ifdef option required

Changed in this revision

DS18B20.h Show annotated file Show diff for this revision Revisions of this file
diff -r b07b40825282 -r a2306865901f DS18B20.h
--- a/DS18B20.h	Tue Mar 25 19:01:36 2014 +0000
+++ b/DS18B20.h	Thu Mar 27 22:50:08 2014 +0000
@@ -4,21 +4,23 @@
 #include "mbed.h"
 #include <stdint.h>
 
-//
-// 25 March,2014 MHey add #define option for larger H,I,J delay values 
+// 25 March,2014 add #define option for larger delay values 
 // to allow extra 1-bit bus settling time accommodating 3ft extension  
 // cable with higher parasitic capacitance
-// If extension cable, add #define CABLE_EXT_DELAYS 
 
 /** A DS18B20 Dallas 1-wire digital thermometer interface.
  *
+ * 25 March,2014 added larger DELAY values to allow
+ * extra 1-bit bus settling time accommodating 3ft extension  
+ * cable with higher parasitic capacitance.
+ *
  * Currently supports 9, 10, 11 or 12-bit conversions. Fewer bits
  * require less conversion time from 93.75ms to 750ms. Also supports
  * reading back the 8-byte internal ROM. Orignal code copied from
  * DS18B20 C program by Niall Cooling (thanks!) and wrapped in C++
  * class by this library.
  
- * modified H,I,J delay values to allow extra 1-bit bus 
+ * modified delay values to allow extra 1-bit bus 
  * settling time accommodating 3ft extension cable 
  * (with higher parasitic capacitance)
  * #define CABLE_EXT_DELAYS // extend reset() settling delays for extension cable
@@ -121,15 +123,10 @@
     unsigned SetResolution(unsigned resolution);
 
 protected:
-   // 25 March,2014 MHey modified H,I,J to allow extra settling time with longer cable (capacitance)
-    // Timing delay for 1-wire serial standard option
-#ifndef CABLE_EXT_DELAYS
-    enum DELAY { A = 6, B = 64, C = 60, D = 10, E = 9, F = 55, G = 0, H = 480, I = 70, J = 410 };
-#endif
+//    enum DELAY { A = 6, B = 64, C = 60, D = 10, E = 9, F = 55, G = 0, H = 480, I = 70, J = 410 };
 
-#ifdef CABLE_EXT_DELAYS
-       enum DELAY { A = 6, B = 64, C = 60, D = 10, E = 9, F = 55, G = 0, H = 580, I = 90, J = 510 };
-#endif
+// Use the following delays when additional cable parasitic capacitance is present:
+    enum DELAY { A = 8, B = 74, C = 70, D = 20, E = 10, F = 65, G = 0, H = 580, I = 90, J = 510 };
 
     // Device byte commands over 1-wire serial
     enum COMMANDS { READ_ROM = 0x33, CONVERT = 0x44, READ_SCRATCHPAD = 0xBE,  WRITE_SCRATCHPAD = 0x4E, SKIP_ROM = 0xCC };