Unexpected GPIO behaviour; reading 0 where 1 expected
Posted: Tue Apr 17, 2012 5:58 pm
I configured thusly:
J2[9].function(PINJ2_PD_GPIO);
J2[9].hiz();
and used J2[9].read() to examine it.
With pin 9 unconnected, I see 0.
When connected to J2 pin 2 (+3v3) through a 680 ohm resistor, no problem - I see a logic 1.
But when I use a 10k resistor, I get 0.
That sort of buggers my plan to attach an RC network to the pin and measure the time until I see a 1, as a way of determining resistance. The resistance I wanted to measure gets up to 100K or so. Is there a strong pulldown on these pins? Can I turn it off?
Barring that, is there a better way to measure resistances (between about 1k to 120K) with a pin? TIA.
J2[9].function(PINJ2_PD_GPIO);
J2[9].hiz();
and used J2[9].read() to examine it.
With pin 9 unconnected, I see 0.
When connected to J2 pin 2 (+3v3) through a 680 ohm resistor, no problem - I see a logic 1.
But when I use a 10k resistor, I get 0.
That sort of buggers my plan to attach an RC network to the pin and measure the time until I see a 1, as a way of determining resistance. The resistance I wanted to measure gets up to 100K or so. Is there a strong pulldown on these pins? Can I turn it off?
Barring that, is there a better way to measure resistances (between about 1k to 120K) with a pin? TIA.