#include <htc.h>
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT
& BORDIS & IESODIS & FCMDIS);
int main()
{
ANSEL = 0x01;
TRISC = 0x00;
PORTC = 0x00;
TRISA = 0xFF;
ADCON0 = 0b000000001;
ADCON1 = 0b000100000;
int ADCState = 0;
int ADCValue = 0;
int array[5] = {0x00, 0x01, 0x02, 0x04, 0x08};
int i=0;
while(1)
{
PORTC = ADCValue;
switch(ADCState)
{
case 0:
GODONE = 1;
ADCState++;
break;
case 1:
if(!GODONE)
ADCState++;
break;
case 2:
ADCValue = ADRESH;
ADCState = 0;
break;
}
}
}