When pulling something up or down why is a resistor used and it not just connected straight to the +V or 0V rail?
-
2\$\begingroup\$ If it were connected directly to V+, then it would always be V+. You couldn't pull it down. \$\endgroup\$– endolithCommented Mar 7, 2011 at 16:36
-
1\$\begingroup\$ @endolith - that's the answer. Simple. And you would create a short circuit trying to pull it down. \$\endgroup\$– stevenvhCommented Jun 15, 2011 at 10:19
5 Answers
It limits current to protect the switch (transistor, etc.) and allows signal sources with limited driving capability to change that node's voltage. Rails generally have high drive capability, or low resistance. Think voltage divider, including source impedance of signal and rail, then let the rail impedance be 0-ohms for simplicity.
Other factors, other than operating current and voltage drops, to determine the pull resistance is charge time and substrate leakage. A 2M-ohm pull-down resistor on a top layer exposed to humidity and salts won't do anything due to sub-1M-ohm electrical resistance of grime layer.
-
2\$\begingroup\$ If the board is exposed to environmental conditions that severe, the value of your pull-up isn't what you should be worried about. \$\endgroup\$– Nick TCommented Mar 6, 2011 at 23:13
-
\$\begingroup\$ Often have boards subjected to high humidity and hydrocarbon mist (exhaust, etc.), @NickT, but you are right: salts would be a killer. \$\endgroup\$– tybluCommented Mar 7, 2011 at 8:25
-
\$\begingroup\$ if they are, a sealed enclosure and/or conformal coating is a must. The only reason that you should up the strength of a pull-up is for manufacturing reasons (flux residue left on the board) or for part tolerances, especially IC and transistor leakage at higher temperatures. \$\endgroup\$– Nick TCommented Mar 7, 2011 at 15:50
-
\$\begingroup\$ Well, conformal coatings have measurable conductance, too... \$\endgroup\$– tybluCommented Mar 8, 2011 at 1:05
Another point not mentioned is that if it's necessary to alter the board, it's possible to pull off the resistor and replace it with a wire connecting one of the resistor pads to something else. By comparison, trying to rework a surface-mount pin which connects to a power ground plane using a via which is under the chip can be difficult or impossible (at least difficult enough that scrapping the board would be cheaper).
-
\$\begingroup\$ Yes, though this could be done with a 0-ohm SMT part too. \$\endgroup\$ Commented Mar 8, 2011 at 18:24
-
\$\begingroup\$ @Chris Stratton: Indeed it could, but usually there will be some other resistor value that's already used elsewhere on the board that would work just as well. The rare possibility that a port pin might accidentally get configured as an output might not justify using a part where none would otherwise be needed, but if one is going to use a part, it may as well be a resistor. \$\endgroup\$– supercatCommented Mar 8, 2011 at 20:41
You can also think of it this way - without a pull-up (or pull-down) resistor in place on an input, the source of the input would have to directly oppose your device's power supply to change the voltage at that input. Depending on the situation, you'd either cause problems for your power supply, or the input source, or both. With the resistor, the input can be controlled by the input source without inordinate currents. The situation for output pull-ups is similar, except that the 'input source' is the device's output transistor.
Another reason is that it makes it very easy to alter the input - just connect it to the positive supply if it is pulled down, for instance, rather than rewiring the connection. A couple of pins for a jumper are all that is required. A typical example is pin P0.14 on an NXP ARM chip, which determines whether it boots from a serial input or from internal flash memory.
-
\$\begingroup\$ What? I don't understand this? Are you saying its easier to swap it from being pulled up to being pulled down? \$\endgroup\$– DeanCommented Mar 6, 2011 at 22:08
-
\$\begingroup\$ Just one connection has to be made, instead of one having to rewire the input. It applies to both pull-up and pull-down resistors on inputs. \$\endgroup\$ Commented Mar 6, 2011 at 22:22
-
-
\$\begingroup\$ Yes - and you could even manually hold a powered or grounded jumper wire on a configuration pin's pull up/down resistor to over-ride the resistor while tripping the reset. \$\endgroup\$ Commented Mar 8, 2011 at 18:24
If you only want to supply a defined logical level to a definitely unused input, a direct connection to ground or vcc would be ok in my opinion. BUT: if you do that, it is impossible to drive the input from other sources. (see posts above)