You set AN3 as Vref+. What do you have on AN3?
Try setting Vref+ to internal +5v and see what happens...
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
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).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
Which version of PBP are you using?
And try
adcon0 = $c1 : adcon1 = $f0
Last edited by skimask; - 9th March 2008 at 08:32.
Im using PBP 2.47. I tried to change adcon1 and add adcon0 but it still doesnt work. Is the problem in my code or is my port A burnt (I accidentally input ~10V for a short while into the Vref+ pin earlier) ?
Is anything wrong with the quoted code ?
Any help is appreciated.
OK, I found the problem, turns out the defines must be in block letters. Weird that I did not get any compile errors though.
Bookmarks