5.4.1 Custom Setup

Custom Setup

void ExternalSetup(void)
{
    OPA1CON0 = 0x00;    
    OPA1CON1 = 0x00;
    
    //Select OPA1IN0-
    OPA1CON1bits.NSS = 0b000;
    
    OPA1CON2 = 0x00;
    
    //Connect the Inverting Input to OPA1IN-
    OPA1CON2bits.NCH = 0b010;
    
    //Connect the Non-inverting input to OPA1IN+
    OPA1CON2bits.PCH = 0b010;
    
    OPA1CON3 = 0x00;
    
    //Select OPA1IN0+
    OPA1CON3bits.PSS = 0b00;
    
    //Enable the Module
    OPA1CON0bits.EN = 1;
}