Shop OBEX P1 Docs P2 Docs Learn Events
Internal pullup resistor for pushbutton input? — Parallax Forums

Internal pullup resistor for pushbutton input?

ClintClint Posts: 95
edited 2008-07-03 23:31 in General Discussion
Is it acceptable to have a pushbutton connected·between·an input and ground/Vss without·any external resistors? I would·enable the internal pullup resistor for that input to keep the input high when the pushbutton is not pressed.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-07-03 19:24
    Clint, just be sure the I/O pin is never made an output and you will be fine. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • ClintClint Posts: 95
    edited 2008-07-03 19:56
    Thank you Chris. I was reading "Programming the SX Microcontroller" by Gunther Daubach and it seemed to be describing what I wrote above (section 2.2.4.7 pg 213). I just wasn't sure because the SX/B help example for "Digital Dice" showed external resistors being used for a pushbutton.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-07-03 20:26
    Clint, the resistor is for safety in case the I/O pin ever becomes an output. In an ideal situation this will never happen. [noparse];)[/noparse] Of course, the price of insurance is cheap in this case. A 220 ohm resistor is mere pennies for peace of mind. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • ClintClint Posts: 95
    edited 2008-07-03 21:46
    Other than a programming error, is there any other reason that pin might become an output?
  • ZootZoot Posts: 2,227
    edited 2008-07-03 23:31
    No. Unless you have turned off the initialization routine in your program (that is generated by SX/B) which clears registers and "defaults" the I/O pins to input. But that would be a programming error also smile.gif since it would be you who did it smile.gif

    I will add that the protecting resistor also protects agains over-voltage, over-current, not just the short-circuit that might happen if the pin is made an output. Remember that the SX has both pin source/sink and whole-chip source/sink limits. You don't want to overdraw through the pin(s).

    On a Stamp I always use them, on SX projects it depends on the project, my comfort level, space trade-offs, etc. (big difference between frying a (2.79 SX and a 79.00 Stamp).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.