With no AC signal applied to the ADC inputs:
- Call the
ADC_calibrateOffsets() function once at start-up before the
App_startDataCollection() function.
- This function averages 1000
consecutive ADC readings on the voltage and current channels to find the DC
midpoint:
- ADC_calibrateOffsets(); // call with no AC input
connected
- The function stores the measured
averages in the internal variables g_voltageOffset and
g_currentOffset. These averages are then subtracted from every
subsequent ADC reading in the ADC_readNormalized() function. The
theoretical midpoint for a 12-bit ADC with a bipolar signal centered at Vref/2
(1.65V) is 2048, but component tolerances shift this midpoint in practice.
-
If the
ADC_calibrateOffsets() function is not called, the default values
of ADC_VOLTAGE_DC_OFFSET and ADC_CURRENT_DC_OFFSET are used,
as defined in the adc_config.h file (both default to 2048.0).