Analog Devices / mbed-drivers
Embed: (wiki syntax)

« Back to documentation index

CN0396 Class Reference

CN0396 Class Reference

The CN0396 class. More...

#include <CN0396.h>

Public Member Functions

 CN0396 (PinName csad, PinName csrdac, PinName cstemp)
 CN0396 class constructor.
void init ()
 Initializes the board.
void read ()
 
  • Reads the sensor and computes the PPM values

float get_feedback_resistor_value (float sensitivity, float range)
 computes the feedback resistor value for the sensor
void configure_feedback_resistors (float resistance1, float resistance2)
 configures the RDACs with the resistance values
void data_to_voltage (uint16_t adcValue, float *voltage, int gain_adc=1)
 computes ADC counts-to-voltage in unipolar configuration
void data_to_voltage_bipolar (uint16_t adcValue, float *voltage, int gain_adc=1)
 computes ADC counts-to-voltage in bipolar configuration
float compensate_ppm (float result, float temp, sensor_type_t sensor)
 compensates ppm value based on temperature reading

Data Fields

const ppm_compensation_t ppm_compensation [COMPENSATION_TABLE_SIZE]
 compensation look-up table

Detailed Description

The CN0396 class.

Definition at line 11 of file CN0396.h.


Constructor & Destructor Documentation

CN0396 ( PinName  csad,
PinName  csrdac,
PinName  cstemp 
)

CN0396 class constructor.

Parameters:
csad- chipselect pin of the ADC
csrdac- chipselect pin of the RDAC
cstemp- chipselect pin of the temperature sensor

Definition at line 19 of file CN0396.cpp.


Member Function Documentation

float compensate_ppm ( float  result,
float  temp,
sensor_type_t  sensor 
)

compensates ppm value based on temperature reading

Parameters:
result- ppm value before compensation
temp- temperature used in compensation
sensor- sensor id
Returns:
compensated value

Definition at line 107 of file CN0396.cpp.

void configure_feedback_resistors ( float  resistance1,
float  resistance2 
)

configures the RDACs with the resistance values

Parameters:
resistance1- resistance of RDAC1
resistance2- resistance of RDAC2
Returns:

Definition at line 40 of file CN0396.cpp.

void data_to_voltage ( uint16_t  adcValue,
float *  voltage,
int  gain_adc = 1 
)

computes ADC counts-to-voltage in unipolar configuration

Parameters:
adcValue- value in counts
voltage- voltage value returned by the method
gain_adc- the gain of the adc

Definition at line 25 of file CN0396.cpp.

void data_to_voltage_bipolar ( uint16_t  adcValue,
float *  voltage,
int  gain_adc = 1 
)

computes ADC counts-to-voltage in bipolar configuration

Parameters:
adcValue- value in counts
voltage- voltage value returned by the method
gain_adc- the gain of the adc

Definition at line 30 of file CN0396.cpp.

float get_feedback_resistor_value ( float  sensitivity,
float  range 
)

computes the feedback resistor value for the sensor

Parameters:
sensitivity- sensor sensitivity
range- sensor range
Returns:
resistor value

Definition at line 35 of file CN0396.cpp.

void init ( void   )

Initializes the board.

Definition at line 71 of file CN0396.cpp.

void read ( void   )

  • Reads the sensor and computes the PPM values

Definition at line 122 of file CN0396.cpp.


Field Documentation

const ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE]
Initial value:
 {
        { -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}
    }

compensation look-up table

Definition at line 34 of file CN0396.h.