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
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;
}