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.

When configuring input I/O to Tristate and when to Pull-up/down?

Status
Not open for further replies.

EngIntoHW

Member
Hello.

First, thank you all for the help that so many forum members give here to others.

When you configure a digital I/O pin to be General Purpose Input pin, you can either set it to Tristate mode, or Pull-up/down mode.

What makes you decide which mode to set it to?

Thank you.
 
Typically pull-up or pull-downs are port wide and you may only want to use them on a single pin/bit. In that case you might opt to use a single external pull-up resistor and leave the pin in high impedance mode with the rest of the port untouched. It's really a matter of what you're making, technique and personal preference.
 
Hey,

When the Uc's IO input pin is to receive interrupts from an external IC, would it be correct to say that you'd want the Uc's IO input pin to be set to Pull-up/down mode, and not to Tristate mode, as the external IC might shut down at some stage, and you wouldn't want it to trigger an interrupt?

However, what if the VDD of the Uc is different than the VDD of the extermal IC, wouldn't it be better to set the Uc's IO input pin to Tristate in order to save on power consumption of the system?

Thanks.
 
Last edited:
Hey,

When the Uc's IO input pin is to receive interrupts from an external IC, would it be correct to say that you'd want the Uc's IO input pin to be set to Pull-up/down mode, and not to Tristate mode

No. You would want the pin configured in it's tri-state mode, a high impedance input. You should take steps to keep a device/IC that's connected to the microcontroller from turning off while connected. If it's an absolutely imperative to your project then use an external pull-up or pull-down resistor. Which direction you go depends on what the resting state of the interrupt trigger is. If the interrupt signal is normally high use a pull-up, if it's low use a pull-down. It also depends on how you have the interrupts configured, on rising edge, falling edge and on change.

Overly broad generalization for simplicities sake:
Tri-State = Input
High/Low = Output

If you need to drive a value (0/1, high/low, true/false) make the pin high or low. If you need the pin to accept input from external circuitry it will always be an input, tri-state high impedance.
 
Last edited:
Hey LTX,
Thank you.

I understand from you that an input pin of an Uc should be always configured in Tristate mode.
Could you explain why?
What're the benefits of that?
As I dont see the difference for example between:
(Tristate Mode + External Pull-Up resistor)
and
(Pull-Up Mode).
 
LTX, I don't follow your tips at all. I'm not sure about PICs myself but AVR's each individual I/O line has it's own pull up bit. I don't believe any AVR's have a pulldown, pullups are generally more useful anyways, but that's coming from my experience.

Your overly broad generalization is just that.. overly broad and confusing. Tri-state is a general term for an i/o line that can go high low or hi-z and has nothing to do with a pullup or pulldown.

These are things that I've come to find being generally true for usage of pull ups on tri-state inputs.

A tristate I/O line when needing to be used as an input would generally be used in the hi-impedance state (no pull up/down) when the external circuit needs to be able to completely control the I/O line such as in a multidrop tri-state bus, or when it's being used as an analog input.

A tristate I/O line when being using as an input would have an active pullup in the situation of an external switch grounding that input to allow for contact switch detection. a pullup/down is used for this because it requires no external resistor to keep the switch in a known state.

Any input on a micro controller that might be allowed to float should have a pullup or down enabled when the chip goes into sleep mode because external coupling of the I/O line may cause the pin to oscillate around the schmit trigger threshold of the I/O line causing power loss during every state change. Hi-Z inputs can easily couple to circuits inches away if the traces allow it to. A bad example of this would be if an I/O line (even if it didn't trigger the MCU to wake up) oscillating at the clock frequency of a nearby device could cause multiple ma's of current draw even if the sleep mode of the chip only consumes ua.
 
The term you should be using is hi-z or high impedance. Tri-state is not a 'mode' it is simply a term used to signify that an I/O line can be driven to either rail for high/low as well as being put into a hi-z state. Pullup/downs aren't even related to an I/O line being tri-state capable and is a discrete topic. Tri-state I/O lines that have a pullup or down (typically pullup) have more uses than a basic tri-state port though.
 
Last edited:
Sceadwian correct you are. It was early and I was rushing to answer before I headed out the door. I crossed terms and made a few other inaccurate statements which only hurts newcomers. Thanks for correcting them and pointing them out.

And of the PICs I've used, as I mentioned above, the pull-ups are port wide. When referencing pull-downs I meant external pull-downs, I have yet to find those in a uC also.
 
No problem LTX you just confused the heck out of me. In your defense I've made far worse hasty posts than that by far =>
 
And of the PICs I've used, as I mentioned above, the pull-ups are port wide. When referencing pull-downs I meant external pull-downs, I have yet to find those in a uC also.

AVR XMEGA controllers have configurable driver and pull settings for totem-pole, pull-ups, pull-downs, wired-or, bus-keeper, slew-rate-control, inverted I/o and virtual ports for accessing single bit memory base.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top