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.

Unused MCU pins

Status
Not open for further replies.

TucsonDon

Member
I have a MCU that i am not using all the pins. Can I tie the pins directly to Vss or do i need a pull-down resistor? If I need a resistor, can I use one resistor for all or several pins or do I need a resistor for each pin?
 
I guess it all depends on the function of the unused pin.

If the pin is a simple digital I/O, just configure it as an output and leave it open circuit.

Pins which are always outputs can just be left open.

Pins which are always inputs can be tied down to Vss, generally no need for a resistor.

JimB
 
Or you can just leave them as is and not address those pins in code at all. Easier to write 0's to those pins and configure them as outputs. No additional components necessary.
 
not address those pins in code at all.
I remember in my early days of PIC programming, I had a setup which behaved very erratically.
I eventually found a floating pin which was configured as an interupting digital input.
I never made that mistake again!

JimB
 
Or you can just leave them as is and not address those pins in code at all. Easier to write 0's to those pins and configure them as outputs. No additional components necessary.

As JimB said, if a pin is an input only, you need to tie it up or down - not just leave it floating. Any bi-directional pins (almost all of them) should be set as outputs and set either high or low - is consumption is critical, it'sworth measuring to which (if either) gives the lowest current consumption.

Historically, there was LOT'S and LOT'S of debate decades ago about how best to treat unused pins - with no definite 'best' solution winning.

Essentially the important thing is - don't let unused inputs float.

If you don't address the pins in code at all, you can't be 100% certain what they are doing - hence the MCC generates TRIS instructions for all ports, although it seems to default to unused pins as inputs (presumably for safety reasons, to reduce triggering of circuits that might be conected to those unused pins).
 
The only time I've had an issue is with older PIC16's that use a dedicated LVP select pin (16F88x comes to mind). If you dont tie this pin low and leave LVP enabled in the configuration word, it will float in and out of programming mode. Disabling LVP on these pics stopped that.

The newer PICs don't have a dedicated LVP pin and use MCLR just like HVP so its a non issue on the newer parts.

I think most of the newer PIC18F parts have weak internal pull ups on every port that can be enabled as well. This option would probably offer the least current consumption.
 
The only time I've had an issue is with older PIC16's that use a dedicated LVP select pin (16F88x comes to mind). If you dont tie this pin low and leave LVP enabled in the configuration word, it will float in and out of programming mode. Disabling LVP on these pics stopped that.

The newer PICs don't have a dedicated LVP pin and use MCLR just like HVP so its a non issue on the newer parts.

I think most of the newer PIC18F parts have weak internal pull ups on every port that can be enabled as well. This option would probably offer the least current consumption.

Like I said, it was discussed endlessly decades ago - a weak pullup is usually still wasting power - pulling the down down is likely to be better. But simply setting the pins as outputs, may be better as well.

As I mentioned above, if you need the lowest possible consumption (and I VERY often do) try all options, and MEASURE the differences.

For what it's worth, in my quest for the least possible consumption, and after measuring on particular PIC's, I set the pins as outputs.

If you've got a floating input pin, while it may not cause a problem, it WILL considerably increase consumption as the CMOS input stages drift in and out of an analogue region.
 
All,
Thanks for your input
I have to be careful on circuit management because the PCB program router will only allow 250 pads.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top