program Adc_Test
dim temp_res as word
main:
ADCON1 = $80 ' Configure analog inputs and Vref
TRISA = $FF ' PORTA is input
TRISB = $3F ' Pins RB7 and RB6 are output
TRISD = $0 ' PORTD is output
while TRUE
temp_res = Adc_Read(2)
PORTD = temp_res ' Send lower 8 bits to PORTD
PORTB = word(temp_res >> 2) ' Send 2 most significant bits to PORTB
wend
end.