Microcontroller › 8051 › pull up resistor › Regarding pull up/pull down
Regarding pull up/pull down basics,
A controller pin can be used for two purposes, to give an output and to take an input. So pull up/pull down resitors are used for both input and output configuration of a pin.
Suppose the pin is set as input;
If our input device give a 5V, the controller detect a logic 1 at the input
If our input device give a 0V, the controller detect a logic 0 at the input ( I’m talking about ideal conditions )
Assume if the connection to the input device somehow got interrupted, and the device is no longer attached to the input pin. In such a case we have neither logic high nor logic low at the input pin, and the controller can’t decide which logic should be read in.
To avoid such conditions we set a default value at the input pin using pull up/pull down resistor. If we pull up the pin the default value at the input pin will be logic 1, and if we pull down there will be a default input value of logic 0, no matter wheather there is an input device present or not.
Now suppose the pin is set as output;
You know, we just can’t directly drive a relay, buzzer etc. using microcontroller, because the controller dosen’t have that much current sourcing power. So we use a low value pull up resitor at the output pin to directly drive the device using VCC, and if we want to turn off the device, we just give a 0V as output and all the current through the resistor will be sinked into the controller.
We decide wheather to use pull up or pull down at the output pin depending upon the internal circuit design of the pin, mainly its current sinking and sourcing power.