Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ADC for 2 analogue inputs

Status
Not open for further replies.

flemmard

New Member
Hi all,
I need to read 2 different analogue inputs to PIC16f877.These are my macros for those inputs.Can anyone please check whether my ADCON0 values are correct ?Anyother simple way to take 2 different analogue inputs?
thanks

Code:
unsigned char read()
{
       
         ADCON0 = 0b11000101;  //channel 1
         ADCON1 = 0x00;
         
         ADGO=1;
         
                  while(ADGO) continue;
                  
  

         return ADRESH;
}

unsigned char read1()
{
         
         ADCON0 = 0b11001101; // channel 2
         ADCON1 = 0x00;
         
         ADGO=1;
         
                  while(ADGO) continue;
                  
  

         return ADRESH;
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top