i m using PIC 16F877A for my project ...i want to use only one pin AN0 for analog input ...i m using SourceBoost IDE c compiler to programme the microcontroller....plz help me to configure it ...
ADC configure code for all analog inputs ....
void init_adc(void){
volatile bit adc_on @ ADCON0 . ADON; //AC activate flag
set_bit(adcon1, ADFM); // AD result needs to be right justified
// set_bit(adcon1, PCFG0); // all analog inputs
// set_bit(adcon1, PCFG1); // Vref+ = Vdd
// set_bit(adcon1, PCFG2); // Vref- = Vss
set_bit(adcon0, ADCS1); // Select Tad = 32 * Tosc (this depends on the X-tal here 10 MHz, should work up to 20 MHz)
clear_bit(adcon0, CHS0); // Channel 0
clear_bit(adcon0, CHS1); //
clear_bit(adcon0, CHS2); //
adc_on = 1; // Activate AD module
}
i want to use only one input AN0.....what changes have to made in the code
ADC configure code for all analog inputs ....
void init_adc(void){
volatile bit adc_on @ ADCON0 . ADON; //AC activate flag
set_bit(adcon1, ADFM); // AD result needs to be right justified
// set_bit(adcon1, PCFG0); // all analog inputs
// set_bit(adcon1, PCFG1); // Vref+ = Vdd
// set_bit(adcon1, PCFG2); // Vref- = Vss
set_bit(adcon0, ADCS1); // Select Tad = 32 * Tosc (this depends on the X-tal here 10 MHz, should work up to 20 MHz)
clear_bit(adcon0, CHS0); // Channel 0
clear_bit(adcon0, CHS1); //
clear_bit(adcon0, CHS2); //
adc_on = 1; // Activate AD module
}
i want to use only one input AN0.....what changes have to made in the code