grounding output pin w/no resistor?
northcove
Posts: 49
Am I harming the Propeller by testing for momentary switch closures that ground a pin without a resistor using the following code?
Thanks!
dira [noparse][[/noparse] pin ]~~ 'briefly set as output outa [noparse][[/noparse] pin ]~~ 'charge it (lasts < 150uSec at PLL2X) dira [noparse][[/noparse] pin ]~ 'set input return !ina [noparse][[/noparse] pin ] & 1 'return button down
Thanks!
Comments
-Phil
If you switch the pin to ground, what do you expect when reading ina? It will be 0 if the switch is 'on' but it can be anything if the switch is 'off' because then it's floating. It will see whatever the electromagnetic fields surrounding will generate.
-Phil
obex.parallax.com/objects/279/
With the keypad, the method uses a capacitive PIN approach to read the keypad.
The basic idea is that ALL pins are made LOW and an OUTPUT to "discharge" the I/O pins.
Then, ALL pins are set to an INPUT state.
At this point, only one pin is made HIGH and an OUTPUT at a time.
If the "switch" is closed, then a HIGH will be read on the input, otherwise a LOW will be returned.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I have used your approach many times although I must admit I will use some sort of current limit resistor to cover me in the case of a software glitch. Of course a pullup will work but there are reasons why you would also do it this way. Anyway, kludges are good for where you need a kludge, just don't let it become a habit.
*Peter*
-Phil
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 6/7/2009 5:16:23 PM GMT
But you have boards, and they work, so I guess it doesn't matter.
BTW, you can get 0612 quad resistors that are easier to solder than 0603 singles, since they won't tombstone, and take up way less space than four 0603s. You will need some solder braid to mop up the inevitable bridge, though.
-Phil
What?!!! Free shipping?!! We don't get that here in the 'States! (Now I wonder if they tack on a little extra so you guys can get it for free. Hmm.)
-Phil
The shipping issue is off topic, but hey, I just got a shipment from Newark/Farnell in the UK shipped to California for $20 via air, while stuff sent domestic via air costs a fortune. So it can work both ways, but go figure?!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
That's a neat idea: no latches required if you check it often enough. When you do that, do you add an extra cap? It seems as if just a gate charge would leak off pretty quickly.
-Phil
In the case of a leaky switch, the attached circuit to help isolate the leakage.
At room temperature in a dry room and on a clean circuit board, the droop even with no external capacitor is on the order of millivolts per second. It can hold its state for a suprisingly long time. BUT! If one waves a hand at it, the charge transfer from body capacitance, static or AC line coupling can carry it rapidly one way or the other.
<<Did I burn out a Propeller pin?>> A good quick test of the functionality of unconnected pins is to charge them first one way, then check for state, and then charge them the opposite way, and again check for state. That tests all three functions, output high, output low, and input high Z.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com