Author: Lloyd D. Clark, Ph.D., Microchip Technology Inc.

The Analog Signal Conditioning (OPAMP) peripheral can be configured as a programmable gain amplifier (PGA) using an internal resistor ladder to select a gain value. Because the resistors in the internal resistor ladder have some tolerances and may vary as a function of temperature or other parameters, the actual gain may be slightly different from the selected gain value. In some applications, it may be beneficial to precisely determine the gain and input offset of the PGA. This document explains how to calibrate the gain and offset of the PGA using the microcontroller's (MCU’s) internal digital-to-analog converter (DAC) and analog-to-digital converter (ADC). The DAC is used to control the voltage at the input of the PGA, while the ADC is used to measure the voltage at both the input and output of the PGA. The values measured by the ADC can be used to calculate the gain and input offset of the PGA. No external components are required.