PDA

View Full Version : IO Question



electric550
07-09-2009, 02:55 PM
If a pin is set as an input and has no connection to anything, then the pin is read, can I assume that the value will be 1 in all cases. Or is it inconsistent. I appoligze for the simple question that has probably been answered already, but I was having difficulty finding the answer. Thanks for the help.

heater
07-09-2009, 03:07 PM
Never trust a "floating" input to be any particular value.

What if the input has such a high input impedance that a passing charged object (a finger) is capacitively coupled to the pin and flips it state?

What if you start using a new version of the chip whose technology inverts any "default" state.

Why do you need to do this?

If you must do this put a pull up (or down) resistor on the pin.

Don't forget there are 8 COGs sharing pins on the Prop so perhaps an input that is not connected to anything externally is driven by another COG internally.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Timothy D. Swieter
07-10-2009, 10:47 AM
As heater said, if you need a specific state on a pin (on or off, high or low, 1 or 0) then you should design the circuit to ensure that state. You can read more about pull-up resistors here: [urlhttp://en.wikipedia.org/wiki/Pull-up_resistor

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com (http://www.brilldea.com) - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com (http://www.tdswieter.com)

Peter Jakacki
07-10-2009, 11:08 AM
I mentioned this before in another post which I can't seem to find and it is a technique I have used many many times. In fact I prefer this configuration for inputs as it is quite flexible. The idea is that you drive the I/O as an output high and/of low and then switch back to an input and test it.

The algorithm is just a simple bit bang which goes a bit like this:
1. PULSE HIGH (10us or so but time depends upon RC time constant)
2. TEST INPUT
3. IF LOW THEN INPUT IS BEING DRIVEN LOW
4. PULSE LOW & TEST
5. IF HIGH THEN INPUT IS BEING DRIVEN HIGH
6. OTHERWISE THE INPUT IS FLOATING




INPUT ---------------10K------ I/O
|
---- 1nf
----
|
GND



*Peter*

P.S. Of course with this configuration you could also use it as a analog output.

Post Edited (Peter Jakacki) : 7/10/2009 3:14:13 AM GMT

Timothy D. Swieter
07-10-2009, 03:48 PM
blog.makezine.com/archive/2009/07/ask_make_pull-up_resistor.html?CMP=OTC-0D6B48984890 (http://blog.makezine.com/archive/2009/07/ask_make_pull-up_resistor.html?CMP=OTC-0D6B48984890)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com (http://www.brilldea.com) - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com (http://www.tdswieter.com)

Sapieha
07-10-2009, 09:12 PM
Hi All.

In my opinion all Yours BUTON and Transistor inputs to PROP have construction problem.
In normal circumstances it is not problem BUT in programing stage with posible fault programing on IO pin's.
It can be opposite Voltages on that IO pin's.

Recommendation's ........

For prevent that problems .... All pin's must have series (100R) resistor between BUTON/PULL-UP resistor and IO pin.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


Sapieha

Post Edited (Sapieha) : 7/10/2009 2:05:10 PM GMT