3.8 Performing an AD Autocalibration


On supported boards (-AT boards), the user may auto-calibrate the board's A/D circuit in software, rather than undergoing a tedious process of manual calibration. Each A/D range has its own set of calibration settings for maximum accuracy. This function enables you to calibrate a single range or all ranges. To calibrate a single range, specify the range in the function call. To calibrate all ranges, specify 255 for the range.

Step-By-Step Instructions

Create and initialize an A/D auto-calibration settings structure (DSCADCALPARAMS).
Select the A/D range to calibrate. For an individual range, select 0-15. For all ranges, select 255.
Select the booot range. This is the range whose calibration settings will be recalled upon power-up.
Call dscADAutoCal and pass it a pointer to this structure in order to calibrate the A/D circuit on the board for the selected range(s).
NOTE: Performing an A/D auto-calibration will take about 1-3 seconds per range, depending on the board type and the range.

Example of Usage for A/D Autocalibration

DSCB dscb;
DSCADCALPARAMS dscadcalparams;
BYTE result;
/* Step 1 */
dscadcalparams.adrange = 255; // calibrate all A/D modes
dscadcalparams.boot_adrange = 8; // set power-up A/D mode to +/-10V
/* Step 2 */
if ((result = dscADAutoCal(dscb, &dscadcalparams)) != DE_NONE)
return result;