Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pull-up and pull-down configuration of pins.

Status
Not open for further replies.

electricity86

New Member
There is something which i dont understand about values of pins.
If you insert the value 1 to a pin does it mean that you open the circuit of the pin (no current), and if you insert the value 0 to a pin you close the circuit?
By saying the 'circuit of the pin' i mean the circuit that contain the '1-logic' voltage source, a Pull-up/Pull-down resistor, and ground.

For example, if there is a GPIO pin P0_0 that is connected to a pull-up resistor, and configured as output, then P0_0=1 means that the pin's output is 1, and P0_0 = 0 means that the pin's output is 0?

and If its connected to pull-down resistor then P0_0 = 1 means that the pin's output is 0?

Thanks!
 
If you set a pin to 1 it means it's pulled up (connected to) +V.

If you set a pin to 0 it means it's pulled down (connected to) 0V.

Pull up and pull down resistors can be used on inputs to achieve the same effect.
 
Most micro controllers output pins use a 'totem pole' output structure and can both source current when high and sink current when low, look at the devices data sheet to find out how much current they can source or sink, 25ma is a common amount.

If an output pin is 'open collector, or open drain' variety then it can only sink current and a external pull-up resistor is required to establish the High level voltage and set the source current level.

Lefty
 
Most micro controllers output pins use a 'totem pole' output structure and can both source current when high and sink current when low, look at the devices data sheet to find out how much current they can source or sink, 25ma is a common amount.

If an output pin is 'open collector, or open drain' variety then it can only sink current and a external pull-up resistor is required to establish the High level voltage and set the source current level.

Lefty

Hey Lefty

I dont understand how is the current issue answers my question.
my question is: is inserting a value 0 to a pin, opens the pin's circuit or closes the pin's circuit?
 
Hey Lefty

I dont understand how is the current issue answers my question.
my question is: is inserting a value 0 to a pin, opens the pin's circuit or closes the pin's circuit?

That is because your question is not very clear. :)

Do you mean writing a 1 or 0 to the latch to make the pin high or low, or writing a 1 or 0 to the tri-state register to make the pin input or output?

A 0 to the latch makes the pin output Vss and a 1 to the pin outputs Vdd.

A 0 to the tri-state makes the pin an output, and a 1 to the tri-state makes the pin an input (on PIC micros.)
 
In other words, it's ALWAYS closed.

Unless it's open-collector or open drain. Is it open-collector or open drain? If not, you don't need or want a pull-up resistor.
 
Hey Lefty

I dont understand how is the current issue answers my question.
my question is: is inserting a value 0 to a pin, opens the pin's circuit or closes the pin's circuit?

inserting a 0 closes a circuit to ground, 0vdc AND opens a circuit path to Vcc, +5vdc.

Inserting a 1 closes a circuit to +Vcc, 5vdc AND opens a circuit path to ground, 0vdc. There is a active circuit path always on for both a 1 and a 0 output state.

Lefty
 
Last edited:
Sinking and sourcing current is very different from the pin being configured as an i/p, input detects the voltage on the pin for which we use pull up and pull down resistors(except in the case of open drain output where a pull up is required). The IC sinks current when it is at a lower voltage then the other end of that pin and sources it when it is connected to a lower voltage.

Lefty explained the 0 and 1 thing very clearly.
 
You have to understand the use of pullup/pulldown more to understand how this works
meaning :

If you have a pin with a external pull-down resistor. And the pin is a output pin. when you set it to a 0 its a 0 when you set it to a 1. Its still a 1. The reason for the resistor being there is so that it can switch faster to ground (0) and also if you use multiple devices like on SPI/I2C pins.

Many devices use those 2/3 lines. SDO, SDA, SCL. So if you have pullups the you can just set the pin to input this way another device can bring the line low. If not you may create a short somewhere because your micro will be send 5v and another device is sending 0v(gnd) on the same line.

So if you have a pullup and set the pin to output and place a 0 there it will indeed change to 0v

and if you have a pulldown and set the pin to output and send a 1 it will be 5v there.


better info than me is: (beside anyone lol)
Pull-up resistor - Wikipedia, the free encyclopedia
and
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top