This module contains sensor calibration routines.
More...
This module contains sensor calibration routines.
- Version
- VERSION Released on RELEASE_DATE
§ __CAPT_STD_CALIBRATION__
| #define __CAPT_STD_CALIBRATION__ (0) |
def CAPT_STD_CALIBRATION selects the conversion gain/count calibration. def CAPT_MAXOFFSET_CALIBRATION selects the max offset calibration.
§ __CAPT_MAXOFFSET_CALIBRATION__
| #define __CAPT_MAXOFFSET_CALIBRATION__ (1) |
§ CAPT_calibrateSensor()
| void CAPT_calibrateSensor |
( |
tSensor * |
pSensor | ) |
|
The calibrate sensor function calibrates all elements in the sensor based on the sensor's input conversion gain and conversion count parameters.
This routine calibrates at one frequency only, and is intented to be used in applications where noise immunity (EMC) features are disabled.
After this function has completed running, the following outputs are set:
- The coarse gain, fine gain, and offset tap for each element are saved in the element structure's pTuning array for frequency 0 only.
- The bCalibrationError parameter in the sensor structure is set if a valid calibration could not be obtained. If this bit is set, it means that the external capacitor being measured could not be scaled to meet the desired conversion gain and conversion count inputs that were requested.
- Parameters
-
| pSensor | is a pointer to the sensor to adjust |
- Returns
- none
§ CAPT_calibrateSensorWithMaxOffset()
| void CAPT_calibrateSensorWithMaxOffset |
( |
tSensor * |
pSensor | ) |
|
The calibrate sensor with max offset function calibrates all elements in the sensor based on the sensor's input conversion count parameter only. This calibration routine achieves the maximim sensitivity for a given conversion count by applying as much offset subtraction as possible.
This routine calibrates at one frequency only, and is intented to be used in applications where noise immunity (EMC) features are disabled.
After this function has completed running, the following outputs are set:
- The coarse gain, fine gain, and offset tap for each element are saved in the element structure's pTuning array for frequency 0 only.
- The bCalibrationError parameter in the sensor structure is set if a valid calibration could not be obtained. If this bit is set, it means that the external capacitor being measured could not be scaled to meet the desired conversion count inputs that were requested.
- Parameters
-
| pSensor | is a pointer to the sensor to adjust |
- Returns
- none
§ CAPT_calibrateSensorWithEMC()
| void CAPT_calibrateSensorWithEMC |
( |
tSensor * |
pSensor | ) |
|
The calibrate sensor function runs all of the necessary calibration routines to achieve the desired sensitivity for a sensor with EMC (noise immunity) enabled. This involves calibrating gain and offset at 4 conversion frequencies based on the sensor's input conversion gain and conversion count parameters, and ensuring that all calibration values are valid.
After this function has completed running, the following outputs are set:
- The coarse gain, fine gain, and offset tap for each element are saved in the element structure's pTuning array for frequency 0-3 (4 total)
- The bCalibrationError parameter in the sensor structure is set if a valid calibration could not be obtained. If this bit is set, it means that the external capacitor being measured could not be scaled to meet the desired conversion gain and conversion count inputs that were requested. This bit is also set if noise was detected on all 4 conversion frequencies, in which case calibration is not possible.
- The bSensorNoiseState parameter in the sensor structure is set if noise was present for at one or more conversion frequencies.
- Parameters
-
| pSensor | is a pointer to the sensor to adjust |
- Returns
- none
§ CAPT_calibrateSensorWithMaxOffsetWithEMC()
| void CAPT_calibrateSensorWithMaxOffsetWithEMC |
( |
tSensor * |
pSensor | ) |
|
The calibrate sensor function runs all of the necessary calibration routines to achieve the desired sensitivity for a sensor with EMC (noise immunity) enabled. This function calibrates all elements in the sensor based on the sensor's input conversion count parameter only. This calibration routine achieves the maximim sensitivity for a given conversion count by applying as much offset subtraction as possible. This involves calibrating gain and offset at 4 conversion frequencies, and ensuring that all calibration values are valid.
After this function has completed running, the following outputs are set:
- The coarse gain, fine gain, and offset tap for each element are saved in the element structure's pTuning array for frequency 0-3 (4 total)
- The bCalibrationError parameter in the sensor structure is set if a valid calibration could not be obtained. If this bit is set, it means that the external capacitor being measured could not be scaled to meet the desired conversion count inputs that were requested. This bit is also set if noise was detected on all 4 conversion frequencies, in which case calibration is not possible.
- The bSensorNoiseState parameter in the sensor structure is set if noise was present for at one or more conversion frequencies.
- Parameters
-
| pSensor | is a pointer to the sensor to adjust |
- Returns
- none
§ CAPT_calibrateGain()
| void CAPT_calibrateGain |
( |
tSensor * |
pSensor, |
|
|
volatile bool * |
pbEndOfConversionFlag, |
|
|
uint8_t |
ui8Frequency |
|
) |
| |
The calibrate gain parameter function identifies the correct gain ratio to achieve the specified conversion gain. Note that this calibration will clear out any offset applied by a call to CAPT_calibrateOffset(). Call this calibration function first.
- Parameters
-
| pSensor | is a pointer to the sensor to calibrate |
- Returns
- none
§ CAPT_calibrateOffset()
| void CAPT_calibrateOffset |
( |
tSensor * |
pSensor, |
|
|
volatile bool * |
pbEndOfConversionFlag, |
|
|
uint8_t |
ui8Frequency |
|
) |
| |
The calibrate offset parameter function identifies the correct offset tap to achieve the specified conversion count.
- Parameters
-
| pSensor | is a pointer to the sensor to calibrate |
- Returns
- none
§ CAPT_calibrateForMaxOffset()
| void CAPT_calibrateForMaxOffset |
( |
tSensor * |
pSensor, |
|
|
uint16_t |
ui16MaxOffsetStartPoint, |
|
|
volatile bool * |
pbEndOfConversionFlag, |
|
|
uint8_t |
ui8Freq |
|
) |
| |
The CAPT_calibrateForMaxOffset function identifies the correct offset tap and gain ratios for each element in a sensor when calibrating at the specified frequency. The target result is a conversion result as close as possible to the sensor's conversion count parameter, with the max amount of offset subtraction applied. The conversion gain parameter is not used with this calibration option.
- Parameters
-
| pSensor | is a pointer to the sensor to calibrate |
- Returns
- none