Quote Originally Posted by skimask View Post
You set AN3 as Vref+. What do you have on AN3?
Try setting Vref+ to internal +5v and see what happens...
For the first code, I have a voltage regulator giving 2.5V to AN3.

I have tried using internal 5V Vref+ for the code below
define osc 20

define adc_bits 10 'define number of bits in result
define adc_clock 3 'clock source3=RC
define adc_sampleus 50 'set sampling time in microsec

trisa = %11111111
trisd=0
adcon1 = %10000010

pause 500

adc var word

start:

adcin 0, adc

if adc > 10 then
high portd.0

else
low portd.0

endif

pause 500

goto start
and i input the same 2.5V into channel 0, but I cannot get portd.0 to go high ? Ive also tried changing to 'define adc_clock 2' or (20Mhz which is same as my OSC freq).