Hello,
I try to read AD value with the Adcin function on a 16F876 device.
It's very strange, I can read values with success only on port AN0.
If I try to get values on Port AN1 or AN2, I receive some random value...
I use PBP 2.42a .
Thanks for any idea or suggestion.
Charles
My code :
'
DEFINE OSC 20
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 10
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000000 ' Right justify
ADIN VAR PORTA.1 ' work nice with PORTA.0 !!!
ADVAL VAR WORD
ADCIN ADIN,ADVAL
adval = (adval */ 500)>>2
Bookmarks