CN0396 (4-Wire Electrochemical Dual Toxic Gas Sensing System)
Dependencies: AD5270 AD7798 ADT7310
For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
Diff: CN0396.cpp
- Revision:
- 1:024253f170c3
- Parent:
- 0:ef85449aa57f
- Child:
- 2:8d2d32e76157
--- 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)