Unused inputs

RobertN

Member
This has been discussed before, but I'd like to eliminate a component. Unused inputs are normally tied to +V or ground, can this be done without a resistor? Since inputs have weak pull-ups, can several of them be tied together forming a "stronger" pull-up, without being tied to +V or ground?
 

geoff07

Senior Member
You should be ok to set unused, un-terminated, pins as outputs (assuming you have the choice) and then setting the level to low. Otherwise a weak pullup on an input should prevent spurious signals and higher current consumption.
 

westaust55

Moderator
It is not essential/mandatory to tie or add pull-up/down resistors on spare pins. Personally I never add such resistors.

When using the analog inputs, in the past noise on unused channels has been reported to affect the desired/used channel.

For digital inputs, if the program does not use an input then it is irrelevant whether it is high, low, or transiting between the two states.
If looking to reduce power consumption, then yes, such actions can be helpful - see many past posts on this minimisation of power draw.

Tying several inputs together while it can be done, an error in programming making two or more of those pins as outputs with one being high and another low is highly likely to lead to the demise of the PIC/PICAXE chip or a part thereof. This is why it is recommended to use a resistor (220 to 330 Ohms is good) between two pins (usually on interconnected PICAXE chips) where they are bi-directional.
 
Last edited:

Circuit

Senior Member
Since inputs have weak pull-ups, can several of them be tied together forming a "stronger" pull-up, without being tied to +V or ground?
My understanding of the nature of a "weak" pull-up is that it is perfectly capable of holding the PICAXE input high but it may not be sufficient to hold an external device connected to the PICAXE high, depending upon its specific nature. There is, therefore, no point in trying to make it "stronger" where it is simply being used hold an unused pin high. The pull-up is most useful for, for example, connecting a push-button directly to the pin so that it is normally open-circuit, but takes the pin to ground when pressed. As has been commented, the easiest way to deal with unconnected pins is to program them as outputs and set them low.
 

bpowell

Senior Member
If your code isn't reading the pin, or looking for a signal on the pin...what dose it matter if EMI causes it to float around?
 

Goeytex

Senior Member
At what point do you get concerned about an unconnected digital I/O pin(s) being affected by EMI?
When you are seeing odd/erratic behavior on adjacent pins or with the device in general. This is very rare with a Picaxe but quite common with other devices such as Logic chips. Not too long ago I scratched my head for 45 minutes due to noise on the supply rail cause by me not grounding the unused inputs on a 74HC14 Hex Inverter.


IMO, in dealing with digital and mixed signal chips ( including micro-controllers), what is of primary concern here is "unused inputs". With a Picaxe, all I/O pins default to inputs. So any pin that is had not been defined in code will be an input.

To your initial question.
... Unused inputs are normally tied to +V or ground, can this be done without a resistor? Since inputs have weak pull-ups, can several of them be tied together forming a "stronger" pull-up, without being tied to +V or ground?
Yes, unused inputs can be tied directly to ground without a resistor. But as has been noted , if you make a mistake in code and set the pin HIGH it could blow the Picaxe. So this is not a very good idea for a Picaxe.

A better idea (as has also already been noted) is to simply make unused inputs into outputs in your code. This applies to all I/0 pins EXCEPT the one "input only" pin on the Picaxe. For example, PIN C.5 on an 18M2. For these input only pins, it is safe to tie them directly to ground since they cannot be made to outputs.

Like some others here, I do not always tie unused pins to ground or set them to outputs, especially when developing stuff on a breadboard. I have seldom had any problems. However, on any commercial product or on any Picaxe used for automotive applications or any other application where there likely to be supply transients or high levels of EMI there should be no inputs left floating ..... none. It is a simple precaution that cost nothing but a couple of lines of code ....
 

RobertN

Member
In a previous automotive project, the unused inputs were tied together and to +V via 10K. That circuit layout was carried over to this project, which needs room for more components. So the 10K pull-up becomes a candidate for removal. Do most everything in thru hole these days...old eyes and everything else. Will have to a couple more lines of code.
 

Hemi345

Senior Member
Just curious which method provides the most power savings. Internal pullup, external pullup, put as output to low and tied to ground? I don't have a DMM that is probably sensitive enough to tell the difference but definitely interested because of a battery powered project I'm working on that I want to be as efficient as possible.
 

hippy

Technical Support
Staff member
Microchip's AN1416, "Low-Power Design Guide" seems to suggests there's no difference in whatever is done, as long as they are not left as floating inputs ...

"An unused I/O pin should be left unconnected, but configured as an output pin, driving to either state (high or low), or configured as an input with an external resistor (about 10 k) pulling it to VDD or VSS. If such a pin can be configured as an analog input, the digital input buffer is turned off, preventing the excess current consumption caused by a floating signal. Any of these methods will prevent the floating node case, minimizing power."

ww1.microchip.com/downloads/en/AppNotes/01416a.pdf
 

geoff07

Senior Member
Indeed. CMOS inputs consume power mainly when they switch state. What you are trying to do is to prevent an input from receiving a signal (including noise pickup) that causes it to switch state from 0 to 1 or vv. This is highly likely with an unterminated, very high impedance input. It makes little difference (apart from component count) how you do that.
 
Top