5.3.1 Unity Gain Setup

Unity Gain Setup

void UnityGainSetup(void)
{
    OPA1CON0 = 0x00;
    OPA1CON0bits.UG = 1;
    
    OPA1CON1 = 0x00;
    OPA1CON2 = 0x00;
    
    //Connect the Non-inverting input to OPA1IN0+
    OPA1CON2bits.PCH = 0b010;
    
    OPA1CON3 = 0x00;
    
    //Enable the Module
    OPA1CON0bits.EN = 1;
}