CN0396 (4-Wire Electrochemical Dual Toxic Gas Sensing System)

Dependencies:   AD5270 AD7798 ADT7310

Dependents:   cn0396-helloworld

For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all

Files at this revision

API Documentation at this revision

Comitter:
adisuciu
Date:
Mon Nov 07 16:22:55 2016 +0000
Parent:
0:ef85449aa57f
Child:
2:8d2d32e76157
Commit message:
Updated dependencies and fixed for mbed online compiler

Changed in this revision

AD5270.lib Show annotated file Show diff for this revision Revisions of this file
AD7798.lib Show annotated file Show diff for this revision Revisions of this file
ADT7310.lib Show annotated file Show diff for this revision Revisions of this file
CN0396.cpp Show annotated file Show diff for this revision Revisions of this file
CN0396.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AD5270.lib	Mon Nov 07 16:22:55 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/AnalogDevices/code/AD5270/#9f9dd8c48e8a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AD7798.lib	Mon Nov 07 16:22:55 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/AnalogDevices/code/AD7798/#fb6fe6fa2835
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADT7310.lib	Mon Nov 07 16:22:55 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/AnalogDevices/code/ADT7310/#63996d24973b
--- a/CN0396.cpp	Mon Nov 07 15:56:24 2016 +0000
+++ b/CN0396.cpp	Mon Nov 07 16:22:55 2016 +0000
@@ -6,11 +6,15 @@
 #define ADC_GAIN      AD7798_GAIN_1
 #define ADC_SPS        0x05  //50SPS
 
-#define CO_SENS    (75 * pow(10, -9))    /* Sensitivity nA/ppm in 400ppm CO 50 to 100 */
+#define CO_SENS    (75 * pow(10.0, -9.0))    /* Sensitivity nA/ppm in 400ppm CO 50 to 100 */
 #define CO_RANGE   1000 /* Range ppm CO limit of performance warranty 1,000 */
-#define H2S_SENS   (700 * pow(10, -9)) /* Sensitivity nA/ppm in 20ppm H2S 450 to 900 */
+#define H2S_SENS   (700 * pow(10.0, -9.0)) /* Sensitivity nA/ppm in 20ppm H2S 450 to 900 */
 #define H2S_RANGE  100  /* Range ppm H2S limit of performance warranty 100 */
 
+
+//CN0396::
+
+
 /*	CO side	H2S side
 Temperature	Mean 	Mean*/
 
@@ -19,7 +23,17 @@
 CN0396::CN0396(PinName csad, PinName csrdac, PinName cstemp) :
     csad(csad), csrdac(csrdac), cstemp(cstemp), ad(csad), rdac(csrdac), temp(cstemp)
 {
-
+ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE] = {
+        { -30	, 29.9  , 82.3 },
+        { -20	, 38.8  , 84.6 },
+        { -10	, 53.7  , 88.6 },
+        {0		, 69.6  , 92.2 },
+        {10		, 84.9  , 96.2 },
+        {20		, 100.0 , 100.0},
+        {30		, 112.7 , 103.1},
+        {40		, 123.7 , 105.6},
+        {50		, 133.1 , 107.4}
+    };
 }
 
 void CN0396::data_to_voltage(uint16_t adcValue, float *voltage, int gain_adc)
--- a/CN0396.h	Mon Nov 07 15:56:24 2016 +0000
+++ b/CN0396.h	Mon Nov 07 16:22:55 2016 +0000
@@ -8,6 +8,7 @@
 /**
  * @brief The CN0396 class
  */
+ 
 class CN0396
 {
 public:
@@ -31,18 +32,7 @@
 	/**
 	 *  @brief compensation look-up table
 	 */
-    const ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE] = {
-        { -30	, 29.9  , 82.3 },
-        { -20	, 38.8  , 84.6 },
-        { -10	, 53.7  , 88.6 },
-        {0		, 69.6  , 92.2 },
-        {10		, 84.9  , 96.2 },
-        {20		, 100.0 , 100.0},
-        {30		, 112.7 , 103.1},
-        {40		, 123.7 , 105.6},
-        {50		, 133.1 , 107.4}
-    };
-
+    ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE];
 
     /**
      * @brief CN0396 class constructor