Pages: [1]   Go Down
Author Topic: Does an OUTPUT require a Pull Down resistor ?  (Read 2447 times)
0 Members and 1 Guest are viewing this topic.
South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 403
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I know it probably sounds like a dumb question, but I'm new and still learning. Please bear with me.

I want an output pin to remain LOW, so have added the following to the Setup()

void setup() {
pinMode(StrobePin, OUTPUT);
digitalWrite(StrobePin, LOW);
}

Am I correct to say that this does not need an external pull down resistor as well ?
The pin will only occasionally be HIGH for about 5 minutes at a time.

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Correct, no pull-up or down resistors required on output pins. The pin will stay at the last commanded value.

Lefty

Logged

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 403
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Lefty
Logged

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 403
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Correct, no pull-up or down resistors required on output pins. The pin will stay at the last commanded value.

What happens when the board is reset or powered off for a short period, but there is still power to the rest of the circuit ?

Would transistors and Thyristors be prone to floating and being erratic ?

If so, would the best solution be to add a pull down or pull up resistor ( depending on its' usage ) to each output as a matter of practice ?
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

When the ATMEGA chip resets it sets all I/O pins to input and engages all internal pull_up resistors.  So it's not defined as output. I guess pull-down resistors are useful at that moment to output LOW. Hope others confirm this. I've never done this. smiley-roll-sweat
Logged


The Netherlands
Offline Offline
Full Member
***
Karma: 2
Posts: 178
Beep!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wouldn't a diode be better in that case?
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
When the ATMEGA chip resets it sets all I/O pins to input and engages all internal pull_up resistors.
Are you sure about this?

Don
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

atmega does not reset with pullups enabled - if it did, we wouldn't get the questions about the floating pins that crop up.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One frequent useful application for a external pull-down resistor is when controlling a logic level N-channel MOSFET that is switching an independent load and voltage source. The pull-down resistor will ensure that the mosfet is forced off if the arduino was powered off but the external switched load voltage source is still hot.

And yes, the powerup or reset default for I/O pins is input mode, internal pull-ups disabled.

Lefty

Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And yes, the powerup or reset default for I/O pins is input mode, internal pull-ups disabled.
I agree, the datasheet states that rather clearly.  I just don't understand why (1) people make unsubstantiated statements about the device characteristics, and (2) why others blindly believe them.

Don
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Update: sorry for the attitude, I'm apparently missing something. Searched the internet and still can't find where it says atmega328 disables pull-up at reset.

OK here it is something on page 8.The Port B(and etc.) pins are tri-stated when a reset condition becomes active, even if the clock is not running. That's all. Searched pull-up through the doc and nowhere mentioned where the tri-state is also coupled with enabled pull-up or not at reset.

So I'm wrong to say pull-ups are enabled at reset.

floresta, if you're so confident you're right why don't YOU go back to the spec sheet and point out where it says pull-ups are disabled at reset? It's not anywhere after searching through it myself. So maybe I just don't have your quality to see it. By not pointing out the "obvious", you're no better than anyone making mistakes, as you don't point out where the right answer is, which is what you hold against me.

Just show me and could you stop blaming me twice or more for one mistake?
« Last Edit: April 16, 2011, 11:40:29 am by liudr » Logged


Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
floresta, if you're so confident you're right why don't YOU go back to the spec sheet and point out where it says pull-ups are disabled at reset?
You already did it for me, but the first clue is actually at the very beginning of section 13.2 where it says that "The ports are bi-directional I/O ports with optional internal pull-ups."  If pull-ups are optional then they are not enabled by default.  If the pull-ups are enabled by default then the ports are optionally floating.

The definitive statement is the one in section 13.2.1 that you pointed out:  "The port pins are tri-stated when reset condition becomes active...."  If a pin is tri-stated it is by definition pulled neither high nor low.  That's all you need - the pull-up is not enabled - period.


Quote
nowhere mentioned where the tri-state is also coupled with enabled pull-up or not at reset.
It won't be mentioned because the two emphasized terms are mutually exclusive.  Tri-state means high impedance which makes the level indeterminate, not high and not low.

Quote
Just show me and could you stop blaming me twice or more for one mistake?
All I said was: "Are you sure about this?"  I didn't blame you for anything, I had my opinion and I wanted to find out if I had overlooked something. 

Don

And now for some trivia.  If I remember correctly the term 'tri-state' is specific to one manufacturer and the correct generic term is 'three-state' (I may have this backwards).  This is not unlike the current situation with 'I2C' and 'TWI'.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And now for some trivia.  If I remember correctly the term 'tri-state' is specific to one manufacturer and the correct generic term is 'three-state' (I may have this backwards).  This is not unlike the current situation with 'I2C' and 'TWI'.

Like Scotch tape and adhesive tape.  smiley-grin

Lefty
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you floresta. I'm sorry for my attitude. After some searching, I realized tri-stated means the same as High-Z but still it's the property of the gate. The pull-up resistor seems to me to be "not a part of the tri-state gate". P77 is the diagram of a pin. I'll study it more.
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you floresta. I'm sorry for my attitude. After some searching, I realized tri-stated means the same as High-Z but still it's the property of the gate. The pull-up resistor seems to me to be "not a part of the tri-state gate". P77 is the diagram of a pin. I'll study it more.

"Tri-state" defines a possible enabled state of a digital output pin, not an input pin. Some output types are open collector, open drain, TTL output and TTL Tri-state. Each is electrically different. The output pins on an arduino are not strictly defined as Tri-state output pins as there is no way to have the pin enabled as an output pin and still be in a tri-state mode. Once you use the mode statement to set a pin to output, it will immediately assume either a active high or active low state. Only by redefining the pin as an input pin with the mode statement will the pin assume a Hi-Z mode, assuming the internal pull-up is not enabled. An Arduino I/O pin can be made to mimic a tri-state output but only by changing it's mode from output to input and then back to output depending on what state you need it to be placed in. This is seem in the popular Charlieplexing scanning technique.

http://en.wikipedia.org/wiki/Three-state_logic

Lefty

« Last Edit: April 16, 2011, 06:13:16 pm by retrolefty » Logged

Pages: [1]   Go Up
Jump to: