Hi Seb,

This is to be expected. The adc has an internal capacitor. At
converion, it is connected to a pin for some time to 'copy' the
voltage level. The higher the input resistance, the longer this takes.
Next, the capacitor is disconnected from the pin and the actual
conversion is executed.
So if you read a pin with very high input resistance (one that is not
connected), the capacitors voltage will not (hardly) change and the
conversion result is highly influenced by the previous measurement.

No magic ;)
Joep

2010/4/7 Sebastien Lelong <[email protected]>:
> Hi guys,
> I've setup a sample with 2 ADC channels, for 18f4550. Both are read
> regularly, results are sent through serial. ADC channel #0 is connected to a
> voltage divider (1K/1K). The other ADC channel #1 is connected to another
> voltage divider (22K/1K). In this configuration, I got the following
> results:
> Result #0: 508
> Result #1: 1020
> Result #0: 508
> Result #1: 1020
> ...
> So far so good...
> Now I disconnect channel #1. Pin is floating in the air, not connected
> anymore to voltage divider... I would expect some kind of random data on
> this channel, but I got exactly the same result as the one from channel #0:
> Result #0: 508
> Result #1: 508
> Result #0: 508
> Result #1: 508
> Result #0: 508
> ...
> Doing the opposite give the same result from channel #1 (most of the time, I
> admit):
> Result #0: 1020
> Result #1: 1020
> Result #0: 1012  <-- this one is exceptional
> Result #1: 1020
> Result #0: 1020
> Result #1: 1020
> Result #0: 1020
> Result #1: 1020
> Attached is the running sample. I really don't know what's going on. Is my
> assertion about expected random values wrong ? Is there something with PIC's
> internal ?
>
> Cheers,
> Seb
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to