Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CN0396 Class Reference
#include <CN0396.h>
Public Member Functions | |
| CN0396 (PinName csad, PinName csrdac, PinName cstemp) | |
| CN0396 class constructor. | |
| void | init () |
| Initializes the board. | |
| void | read () |
| |
| 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] |
Generated on Tue Jul 12 2022 17:59:52 by
1.7.2
CN0357 - Toxic gas measurement
CN0216 - Weight Scale