'This is really necessary for Analog Input ' Define ADCIN parametersDEFINE ADC_BITS 10' Set number of bits in resultDEFINE ADC_CLOCK 3' Set clock source (3=rc)DEFINE ADC_SAMPLEUS 50' Set sampling time in uS'This is really necessary, use for VARADCvar VAR WORD' Create variable to store result

'This is really necessary for Analog InputTRISA = %11111111' Set PORTA to all inputADCON1 = %10000010' Set PORTA analog and right justify resultPause 500' Wait .5 second

'Set Potentiometer to RA0 and set LED to portd.1' PicBasic Pro program to display result of' '10-bit A/D conversion through serial at 9600 baud'' 'Connect analog input to channel-0 (RA0)

' Define ADCIN parametersDEFINE ADC_BITS 10' Set number of bits in resultDEFINE ADC_CLOCK 3' Set clock source (3=rc)DEFINE ADC_SAMPLEUS 50' Set sampling time in uS

ADCvar VAR WORD' Create variable to store resultTRISA = %11111111' Set PORTA to all input (---potentiometer is set into RA0 as Analog INPUT)ADCON1 = %10000010' Set PORTA analog and right justify result (---Analog Justify)