View previous topic :: View next topic |
Author |
Message |
GDetienne
Joined: 20 Sep 2003 Posts: 47 Location: Brussel - Belgium
|
I/O port not used... |
Posted: Tue Mar 22, 2005 9:54 am |
|
|
Hello,
I use a 16F876A. Some ports are not used.
I have read this week, on this forum, that it's not correct to let the non used port not connected.
Could you give me your advies ?
Port connected directly to ground or to + 5V with resistor (10 K)?
If set_tris() is used, port is declared as Input or Output ?
Thanks in advance.
Detienne Guy. |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 22, 2005 10:27 am |
|
|
Any of:
Set it as an input, and have a resistor pulling it high.
Set it as an output, and have a resistor pulling it low.
Set it as an input, and connect it to anoter pin that functions as an output.
Set it as an output, and drive it either high or low.
There is a 'caveat' with the pull up resistor, that power should not be applied to this, before the power is applied to the PIC.
There is a caveat with attaching it to another output, that you are increasing the loading on this pin when it changes state.
What you are trying to avoid, is the pin floating to an 'indeterminate state' (a voltage between the switching points for 'high', and 'low'), which can make CMOS inputs draw extra power.
Best Wishes |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 22, 2005 10:45 am |
|
|
Line two should be "set it as an input and have a resistor driving it low".
Best Wishes |
|
|
valemike Guest
|
|
Posted: Tue Mar 22, 2005 12:04 pm |
|
|
Ttelmah's right, and the post below from a Microchip FAE re-iterates what Ttelmah says...
Quote: | Hi Mike-
There are many opinions on the best way to handle unused digital I/O. You can configure them as inputs so long as you have them tied to either Vdd or Vss or you can configure them as outputs and leave them unterminated. If you wish to configure them as outputs and terminate them, drive the outputs to the rail you have tied it to--through a resistor- 10k should work just fine.
As I mentioned, there are many opinions on this, and a few customers of mine have their "standard operating procedure" on what to do. Best to just follow that if that is the case with your company... |
|
|
|
GDetienne
Joined: 20 Sep 2003 Posts: 47 Location: Brussel - Belgium
|
Thanks. |
Posted: Tue Mar 22, 2005 4:31 pm |
|
|
Thanks a lot for your advies.
Guy Detienne. |
|
|
Will Reeve
Joined: 30 Oct 2003 Posts: 209 Location: Norfolk, England
|
|
Posted: Wed Mar 30, 2005 10:19 am |
|
|
Belts and braces > as pins nearly always start-up as inputs you can't 100% safe leaving a pin unconnected and setting it as an output as there will be a finite time when it's an input and floating?
Note the ? mark, I've done this on a few old projects and never had problems, but over the last couple of years always tie them to a rail with a resistor and leave them as inputs.
Anyone know the lowest power consumption mode? I presume it's an input tied to GND with 10k? An output must use a tiny bit of current to drive the pin logic?
Keep well,
Will |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Mar 30, 2005 12:04 pm |
|
|
If you have unused pins, it is always nice to use them for a self test. It is a good practice to design your product for test but may not always be feasible. |
|
|
|