void ADC_Init()
{
ADCON2 = 0b10101110 ;//right justify, Frc/64 , 12Tad
ADCON1=0b00000000 ;//ADC ref = Vdd,Vss boven- en onderste venster
TRISBbits.TRISB4=1;//Set RB4 to analog (ANS10) , compile ERROR
ADCON0 = 0b00101001 ;//AN10, ADC on
}
void ADC_Go()
{
ADCON0bits.GO=1 ;//Start conversion , compile ERROR
//ADCPoll:
while(ADCON0bits.DONE==1); //Is conversion done? , compile ERROR
// ; Result is complete - store 2 MSbits in ADCH
ADCH = ADRESH;
ADCL= ADRESL;
}