29.4.2.1 Unity Gain Setup

The Op Amp supports unity gain operation without any external connections. To configure the Op Amp in unity gain configuration, set the UGE bit to ‘1’ in the AMPxCON1 register. In this mode, the Op Amp output is internally shorted to an inverting input and the resulting gain will be one.

Op Amp Unity Gain Buffer

AMP1CON1bits.AMPEN = 1;    //Enable Op Amp 1
AMP1CON1bits.UGE = 1;      //Enable unity gain mode