Pushbutton reading software - Use pushbuttons without pullup resistors!!
Microcontrolled
Posts: 2,461
I have now made my second contribution to the OBEX. This is neither a big nor impressive object, but it is a useful object. I find that while experimenting I run out of pull-up resistors for pushbuttons. This becomes a big deal, as the pushbuttons often return false signals. Here I have developed an object that turns the pin to output, outputs and positive charge and then immediately switches back to input and reads the "ina" register. It works great! Just like you have a pull-up, but you don't! I also have 3 additional PUB's (all use the same method) that take a timeout, wait for a button press, and one that reads a specified group of inputs. If you just need the simple button reading, you can remove all of the PUB's except it and the object only consumes 10 longs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
Comments
VERY riski bisnes.
Regards
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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
If the button is pressed, and it's connected directly to the pin, won't your high output be shorted to ground? This could eventually cause the Prop's output driver to fail.
-Phil
doesn't allow it much time to fry out the chip's output!
If it is a concern, should I pull it from the OBEX?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon Heller
Amateur radio callsign: G1HSM
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
Like your av, eight 32-bit heavies ganging up on an 8-bit "pipsqueak", it's just a "no contest"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Of course it's a waste if you only have one button (adds 100% to the pincount ;o), but if you have more than one the waste gets smaller with every button because all buttons can use the same 'grounding-pin'.
I mean .. I can't imagine running out of resistors for myself, but if that can be a real problem ... for example for a studend ... hard decision ... food or one more resistor ...
And by murphys law this always happens on public holidays.
Post Edited (MagIO2) : 3/11/2010 7:18:48 AM GMT
All is not lost, it turns out. If, instead of connecting the common switch terminals to Vss, you connect them all to a single 330-ohm resistor that goes to Vss, your scheme should still work, and the outputs will be protected.
However, there is still one very remote failure mode: if two buttons are pressed at once, while the program simultaneously malfunctions and sets the pin for one of them high and the other one low, you will get a short. But that's too unlikely to be concerned about, methinks.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
·