I've made a configuration file regarding the registers:
void ADC_Init()
{
ADCON1bits.ADCS2 = 0;
ADCON0bits.ADCS1 = 1;
ADCON0bits.ADCS0 = 0;
//selection of a channel
ADCON0bits.CHS0=0;
ADCON0bits.CHS1=0;
ADCON0bits.CHS2=0;
//result format selection
ADCON1bits.ADFM=0; //right justify
//port configuration
ADCON1bits.PCFG0=0;
ADCON1bits.PCFG1=0;
ADCON1bits.PCFG2=0;
ADCON1bits.PCFG3=0;
//set status sit
ADCON0bits.GO_DONE=1;
//switch on ADC
ADCON0bits.ADON=1;
}
Now how do I get the int reading coming from the input?