Problem in ADC conversion for two pin

Status
Not open for further replies.

ecaits

Member level 4
Joined
Jan 16, 2014
Messages
76
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
579
In PIC16F877, I am using RA0 & RA1 as analog input pin (0-5V). First I will read RA0 pin and display value of ADC on LCD. After delay time, I will read RA1 pin and display value of RA1 pin on LCD. Once again I will read RA0 pin and so on.... I am using common ADC function for A to D conversion.

Which parameter (in ADCON0 and ADCON1) I have to change during switching between RA0 and RA1 pin.

I am getting only pin RA0's value, in case of RA1, ADC not reading the pin and giving the fake value.

I am using hi-tech C compiler.

Plz suggest how can I solve this.
 

In ADCON0 it's the CHS bits that decide which pin is routed to the ADC. See chart "Register 11-1" in the data sheet.
However, I think the Hitech compiler has a library function to read the ADC so you should use that if possible.

Brian.
 

I am using RA0 pin and RA5 pin as input (0-5V) because in PIC DEM2 kit, RA1-RA3 are used for control pin of LCD interface. What should I select in PCFG3CFG0 (A/D port configuration control bit) of ADCON1 register to select pin 0 & 5 as analog input and pin 1 to 3 of port A as digital output???

Plz suggest me..
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…