I am new to using PIC micro-controllers, and I am working on a project that involves reading an analog value. I am using the PIC16F877A. I have found code for using the ADC posted below however when I try to compile it I get the error Error [192] C:\Users\Owner\Documents\Pic Projects\Analog\Main.c; 20.1 undefined identifier "GO_nDONE". Here is my code
#include<htc.h>
#include<pic.h>
#define _XTAL_FREQ 20000000
__CONFIG(UNPROTECT & PWRTDIS & WDTDIS & HS & LVPDIS);
void InitADC(void)
{
ADCON1 = 0x80;
TRISA = 0x2f;
TRISE = 0x07;
ADCON0 = 0x81;
}
unsigned int GetADCValue(unsigned char Channel)
{
ADCON0 &= 0xc7;
ADCON0 |= (Channel<<3);
__delay_ms(10);
GO_nDONE = 1;
while(GO_nDONE);
return ((ADRESH<<8)+ADRESL);
}
void main()
{
}