Sign In

ADC Interface

Bharath kbharath.rs@gmail.com India

Hardware: PIC16F877A ,MPLAB V8.92 Software: C Language,HI-TECH C Compiler,MPLAB V8.92

Undefined symbal GO_nDONE..

Images

Program

unsigned int ADC_Read(unsigned char channel)
{
  int i;
  if(channel > 7) //If Invalid channel selected 
    return 0;     //Return 0

  ADCON0 &= 0xC5; //Clearing the Channel Selection Bits
  ADCON0 |= channel<<3; //Setting the required Bits
  //__delay_ms(2); //Acquisition time to charge hold capacitor
  GO_nDONE = 1; //Initializes A/D Conversion
  while(GO_nDONE); //Wait for A/D Conversion to complete
  for(i=0;i<12345;i++);  
return ((ADRESH<<8)+ADRESL); //Returns Result
}

Replies

R Avinash
2017-02-03 16:42:20
Where did you got the code?

Post a reply to Bharath

Think you can help Bharath ? Then post your thoughts that might help Bharath. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.