Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] Pull Up Resistor and Port Logic

Status
Not open for further replies.

tahir4awan

Full Member level 3
Joined
Nov 29, 2010
Messages
183
Helped
16
Reputation
32
Reaction score
16
Trophy points
1,308
Activity points
2,858
When we use pull up resistor with port assigned as input then what will be its logic state? active high or active low.
 

tgil

Newbie level 1
Joined
Apr 11, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
United States
Activity points
1,289
Active Low and Active High are defined by you in this case. For example, a SPI chip select (CS) line going to a slave device is defined as active low because when the CS line is high the slave device ignores the SPI bus. When the CS is low, the slave device is active.

In your case, if your microcontroller takes an action when your pulled-up input is low, then the input is active low. Otherwise, it is active high.

Keep in mind that signals that are pulled-up consume more current when driven low. So if you are pulling your input high, it should be high most of the time in order to reduce power consumption. For this reason, typically inputs that are pulled high are active low (such as I2C bus lines).
 

KerimF

Advanced Member level 4
Joined
May 17, 2011
Messages
1,461
Helped
374
Reputation
756
Reaction score
370
Trophy points
1,363
Location
Syria
Activity points
12,314
When we use pull up resistor with port assigned as input then what will be its logic state? active high or active low.
If high means high volt... then its logic is high, I mean when it is read by an internal instruction.
Usually pins have internal pull up resistors (or equivalent) so using an external pull down resistor may not give a low state unless its value is small enough to shunt the current going out from the pin (for my Atmel MCU, it is around 50uA) and the logic threshold is about 1.5V.
I believe you already know all this... right?
 

ultrabrains

Full Member level 2
Joined
Feb 14, 2007
Messages
129
Helped
12
Reputation
24
Reaction score
3
Trophy points
1,298
Activity points
2,117
When You use pull up resistor with port assigned as input then logic state of the input pin is active high.
 

embeddedlover

Full Member level 5
Joined
Aug 10, 2007
Messages
279
Helped
46
Reputation
92
Reaction score
38
Trophy points
1,308
Activity points
3,155
As per my understanding, Active High/Active Low terminology is used based on the functional behaviour of the pin on state changes on a pin. For example, this is mainly with control pins on devices. In case of micro controllers pins like RESET*, for other devices like CS*, EN

In your case, if your microcontroller takes an action when your pulled-up input is low, then the input is active low. Otherwise, it is active high.
I completely agree with aith what tgil said. But this is the case with pins like RESET*, But normal GPIO pins (on microcontroller) can be said as pulled low or high and can't be said active high/active low.
 

ultrabrains

Full Member level 2
Joined
Feb 14, 2007
Messages
129
Helped
12
Reputation
24
Reaction score
3
Trophy points
1,298
Activity points
2,117
terminology is used based on the functional behaviour

Active High = when a high (+5v) is supplied to the input pin it performs its predefined funtion
Active Low = when a Low(0v) is supplied to the input pin it performs its predefined funtion
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
When we use pull up resistor with port assigned as input then what will be its logic state? active high or active low.
A pull-up/pule-down resistor is just a high value resistor (like 47K or 100k) that provides the voltage to the input pin when no other device/circuit is connected or when the connected circuit has a high resistance.
This resistor provides a default value of High(pull-up) or Low(pull-down) to the input.

The rest of the code is up to you, you can do whatever you want depending on the type of device you have connected to that pin.
For example, with a pull-up resistor , if you have a device connected that grounds the input when something happens (like a water level alarm) then your input will be active low , when the device connected grounds the input.
Or it can be the opposite with a device that disconnects the gnd when there is an event.

Alex
 
Last edited:

tahir4awan

Full Member level 3
Joined
Nov 29, 2010
Messages
183
Helped
16
Reputation
32
Reaction score
16
Trophy points
1,308
Activity points
2,858
Guys I tell you what is Active High and Active Low
Suppose that we have a device which has input and output.

When input of the device goes high then output of the device also goes high. This device is known as Active High Device i.e A device which becomes Active on High input.

When input of the device goes low then output of the device goes high. This device is known as Active Low Device i.e A device which becomes Active on Low input.

You always see a bar on the active low pins.
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
Guys I tell you what is Active High and Active Low
Suppose that we have a device which has input and output.

When input of the device goes high then output of the device also goes high. This device is known as Active High Device i.e A device which becomes Active on High input.
I would call this a buffer

When input of the device goes low then output of the device goes high. This device is known as Active Low Device i.e A device which becomes Active on Low input.
And I would call this an inverter

A microcontroller can do anything you want it to do so there is no active low or active high, it is your implementation that can do what you want with the input you choose.
You can do something in your code when the input is low or when the input is high, it has nothing to do with the pull-up or pull-down resistor either.

Alex
 
Last edited:

tahir4awan

Full Member level 3
Joined
Nov 29, 2010
Messages
183
Helped
16
Reputation
32
Reaction score
16
Trophy points
1,308
Activity points
2,858
When you pull up say RB0 pin. you connect the pin directly to VCC with a resistor. My question was doesn't it make the RBO pin high so if someone has written a code if(RB0==1) then this condition becomes always true because RB0 is high all the time.
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
The job of the pull-up resistor is to apply a known state to the pin when there is nothing connected to it or something with a high resistance.
If you don't connect anything to the input that is pulled up then you will always read high.
If you connect a button to that input that connects the ground when it is pressed then you can detect when this button is pressed because you will read value 0 instead of 1.

Alex
 

tahir4awan

Full Member level 3
Joined
Nov 29, 2010
Messages
183
Helped
16
Reputation
32
Reaction score
16
Trophy points
1,308
Activity points
2,858
alexan please answer in a simple way.
What I understand that without pull up resistor the RB0 pin is normally low so we give it high signal as input.
and with pull up resistor the RB0 pin is normally high so we give it low signal as input.
Am I right?
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
Yes you are right.
My example was quite simple, a pin with default state of high (because of the pull-up resistor) which becomes 0 when it is grounded.

Alex
 

ZASto

Advanced Member level 3
Joined
Jan 9, 2008
Messages
724
Helped
144
Reputation
291
Reaction score
128
Trophy points
1,323
Location
Messy Corner, 44°47'31.56"N, 20°28'9.16"E
Activity points
4,883
On PIC micro-controllers, if you disable the weak pullup resistors on ports that have them, if you leave the input pins floating (connected to nothing) then there is no defined state of their respective logic level. When you are using a IO pin as the digital input, you must have a defined beginning state that you can test in your program. For example, pullup resistor on RB0 DEFINES its state as HIGH Logic level. When you connect this pin to 0V (remember you still have your pullup resistor) by means of a switch, you deliberately change the logic level of that pin and you can test this condition in your program an act accordingly. When you release the switch, you immediately change the state of the input pin back to high logic level.

Active Low and Active High are relevant only to some pins, i.e. \MCLR, meaning that the ACTIVE state of the Reset pin is LOW for micro to be in reset condition. If you place the pullup resistor on this pin, your program will run normally until you pull \MCLR to the LOW logic level to reset the uC.

As per your "understanding" without the pullup resistor the RB0 pin if FLOATING (if defined as Input).
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
Actually this it true in AVR's too, when the input pull-up is not enabled then the input is in a high-Z state.
In LPC17xx ARM mcu there is a pull-up, pull-down, nor pull-up or pull-down, and repeater(keep the last known state).
I guess different mcu can behave differently but it is good practice to apply some known state to the pins if you intend to leave them unconnected.

Alex
 

tahir4awan

Full Member level 3
Joined
Nov 29, 2010
Messages
183
Helped
16
Reputation
32
Reaction score
16
Trophy points
1,308
Activity points
2,858
Thank you guys for your great help and participation. It really helped me.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top