Hi Gilles,

I am not sure but if you check the adc library you see this code:
   ADCON0_ADON = TRUE                              -- turn on ADC module
   delay_10us(adc_conversion_delay)                -- wait acquisition time
   ADCON0_GO = TRUE                                -- start conversion
   while ADCON0_GO == TRUE loop                    -- wait until conversion 
completed

So when you start reading the ADC there is first a delay of 10us of 
acquisition time and I wonder if this delay influences your measurement.

Kind regards,

Rob


On Tuesday, February 4, 2020 at 8:53:08 AM UTC+1, Gilles BARTHELEMY wrote:
>
>
>> I received my brand new 18F45K22, and tested with it... with exactly same 
> result. I invariably get:
>
> A0 alone (tied to nothing) = 841
> A0  tied to ground = 0
> A0 tied to VCC = 1023
> A0 tied to B7 (i.e OUT_PIN) = 1015
>
> Also, I commented the line "enable_digital_io()" => same measurement.
>
> I can't see any difference in the way it's done with Arduino, and my 
> code... Obviously, I miss something, but where ? Hardware maybe ? Or am I 
> simply blind ? ;-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/18728482-9fd4-42cb-8b6e-f5c7fa55437b%40googlegroups.com.

Reply via email to