I have been trying to use the onboard ADC, and it works, butt when trying on the RPB4 (AN10), it does not respond, am I missing something?![]()
I have been trying to use the onboard ADC, and it works, butt when trying on the RPB4 (AN10), it does not respond, am I missing something?![]()
Can we see your code?
Dave
Always wear safety glasses while programming.
DEFINE OSC 8
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 20 ' Set sampling time in uS
TRISA = %00000000
TRISB =%11111111
TRISC = %00000000
ANSEL = %00000000
ANSELH = %00000100
ADCON0 = %00101000
ADCON1 = %00100000
vinput var PORTB.4
B0 var byte
B1 var byte
clear
inicio:
call cal_pot
pause 500
goto inicio
cal_pot:
adcin vinput,B0
serout PORTA.0, 0 ,["ADCIN = ",#B1,10,13]
return
The same code works for any pin in port A (I have not tried B or C), obviously changing the appropriate ANSEL and ADCON.
Nothing else changes, other than the jumper to the pin. I thought maybe the pin was blown, but different chips yielded the same result.
Thanks
Bookmarks