If you have a switch attached to a pin to make it's value LOW (0V) or HIGH (5V) what happens to the logic gate when the pin is disconnected. Since we've introduced many more logic elements we start to see disconnected pins more often. These pins are essentially disconnected from either a defined HIGH or LOW condition and that means it has the potential to “float” about between 0V and +5V (Vcc) allowing the input to self–bias at any voltage level whether that represents a HIGH or a LOW condition.
This uncertain situation may cause the a digital input to stay at a logic level “0” (LOW) when we actually need a logic “1”, (HIGH) causing the logic gate to have a wrong output. Also once there, this floating and weak input signal could easily change value at the slightest of interference or noise from its neighboring inputs or could even cause it to go into oscillation, rendering the gate practically unusable. We can use Pull up and Pull down resistors to make sure there are no floating value.
We also cannot just tie the inputs directly to HIGH or LOW with a wire. This could cause excessive current flow which could blow fuses or damage a circuit. An example of such a circuit is shown below. Note that if the switch is open, there is no problems. If the switch is closed though, we have short circuit from +5v to ground.
By using these two pull-up resistors, one for each input, when switch “A” or “B” is open (OFF), the input is effectively connected to the +5V supply rail via the pull-up resistor. The result is that as there is very little input current into the input of the logic gate, very little voltage is dropped across the pull-up resistor so nearly all the +5V supply voltage is applied to the input pin creating a HIGH, logic “1” condition. This is shown in the circuit below.
When switches “A”, or “B” are closed, (ON) the input is shorted to ground (LOW) creating a logic “0” condition as before at the input. However, this time we are not shorting out the supply rail as the pull-up resistor only passes a small current (as determined by Ohms law) through the closed switch to ground.
By using a pull-up resistor in this way, the input always has a default logic state, either “1” or “0”, high or low, depending on the position of the switch, thus achieving the proper output function of the gate at “Q” and therefore preventing the input from floating about or self-biasing giving us exactly the switching condition we require.
While the connection between Vcc and an input (or output) is the preferred method for using a pull-up resistor, the question arises as how do we calculate the value of the resistance require to ensure the correct operation of the input.
A Pull-down resistor works in the same way as the previous pull-up resistor, except this time the logic gates input is tied to ground, logic level “0” (LOW) or it may go HIGH by the operation of a mechanical switch. This pull-down resistor configuration is particularly useful for digital circuits like latches, counters and flip-flops that require a positive one-shot trigger when a switch is momentarily closed to cause a state change.
While they may seem to operate in the same way as the pull-up resistor, the resistive value of a passive pull-down resistor is more critical with TTL logic gates than with similar CMOS gates. This is because a TTL input sources much more current out of its input in its LOW state.
Basically, you use a combination of Ohms Law and the data sheet for the circuit you are attaching the resistor to. All digital logic chips come with a data sheet that clearly state what voltages will result in logic 1 (HIGH) or logic 0 (LOW). Anything in the middle range between logic 1 and logic 0 are not recognized as anything. The figure below shows an example for the TTL 74LSxxx series logic gates.
To obtain logic HIGH we need a voltage between 2.0V and 5.25V. Logic LOW is 0V - 0.8V.
R pull-up = (V supply – VH(min)) / Isink
R pull-down = (VL(max) – 0) / Isource
I'm planning to update this section in the future for students who want to dive deeper into this subject. Just a basic understanding is needed for this class.