34.4.2.1 Unity Gain Setup

The Op Amp supports unity gain operation without requiring any external connection from output to inverted input. 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 the 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