Hi,
The input (basically) only sinks current when it's configured as an output and set low. When being used as an input for the ADC it obviously needs to be set to input - just as Mark has pointed out. Then it "sinks" current only when the input is connected to the S/H circuit which leads us to the next issue: Your 100k pot viloates the maximum recommended input impedance by an order of magnitude.
/Henrik.
I have created a voltage divider, 100k and 10k resistors, ADC input connected in their middle point. The problem is that PIC shorts the input to GND, but still works as ADC. This has no relation to input impedance, it feels like same pin is both digital out and analog in at same time. Is this possible?
Hi,
In your original code ( TRISA=%00110000 ) leaves PortA.2 as an output which is wrong.
In your post you contiune to say TRISA=%00110010, to set LATA.2 as input which again, as mark_s points out, is wrong, the above will STILL leave PortA.2 as an OUTPUT.
Your setting of ANSELA in the code is commented out which doesn't really have any effect on the ADC input since it defaults to analog but it WILL have an effect on the pins you want to use as digital.
The ADC DOES put a load on the node when it samples the input that's where the max input impedance comes from. Too high impedance and too short sampling time makes the voltage at the node droop when it's sampled.
/Henrik.
HenrikOlsson,
If you use 10K and 100K for divider, impedance that PIC input see is 9,09K.
Yes I have commented ANSELA because it had no effect anyways.
And I know that ADC needs some current, but not 25mA! On the RA3 or LATA.3 how you call it, which is input only, ADC works just fine and does not hog current.
? reallyRA3 or LATA.3 how you call it, which is input only, ADC works just fine and does not hog current.
RA3 is not an analogue input
the only way a pic I/O pin will sink 25ma is :- if its an output, damaged or fed more volts than vdd
Bookmarks