• AVR Freaks

LockedUnused pins

Author
Guest
Super Member
  • Total Posts : 80500
  • Reward points : 0
  • Joined: 2003/01/01 00:00:00
  • Location: 0
  • Status: online
2004/12/17 08:08:43 (permalink)
0

Unused pins

Coming from my experience making things using discrete logic gates, I always tie unused inputs to either Vcc or GND. What's the general rule as far as PIC chips goes for unused pins?
#1

10 Replies Related Threads

    bobledoux
    Super Member
    • Total Posts : 218
    • Reward points : 0
    • Joined: 2004/10/12 05:54:57
    • Location: Salem, OR USA
    • Status: offline
    RE: Unused pins 2004/12/17 08:41:51 (permalink)
    0
    This is a common question with lots of replies and lots of opinions.

    Preferred option. Tie pins to ground or "high" through 5k to 20k resistors.

    Option to avoid: Don't let unused pins float as inputs.

    My option: Set unused pins as outputs with no connections.

    Floating input can play havoc on chip operation. The resistor technique is most conservative. Setting to outputs works fine for non critical applications.
    #2
    jankop
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2004/11/05 14:12:45
    • Location: Brno, Czech republic
    • Status: offline
    RE: Unused pins 2004/12/17 08:42:37 (permalink)
    0
    They are various alternatives.
    Software set the pin to output (except the MCLR, e.t.c.).
    Software set internal pull-up resistor if exists.
    Tied an external resistor to Vcc or Vss
    < Message edited by jankop -- Dec. 17, 2004 8:45:27 AM >
    #3
    jankop
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2004/11/05 14:12:45
    • Location: Brno, Czech republic
    • Status: offline
    RE: Unused pins 2004/12/17 08:47:56 (permalink)
    0
    2bobledoux:

    Setting to outputs works fine for critical applications too! grin
    #4
    bob_barr
    Super Member
    • Total Posts : 5428
    • Reward points : 0
    • Joined: 2003/11/07 12:35:23
    • Location: Morgan Hill, CA
    • Status: offline
    RE: Unused pins 2004/12/17 08:49:28 (permalink)
    0
    Coming from my experience making things using discrete logic gates, I always tie unused inputs to either Vcc or GND. What's the general rule as far as PIC chips goes for unused pins?

    You're right. Like all CMOS devices, PIC input pins should not be left floating.

    I don't know that there is any general rule, though. (That's like asking "What's the best car?") Everybody seems to have a different opinion of what to do and why their particular way is "the best way".

    Some of the opinions include:

    1) Set the unused pins as outputs and pull them either up or down through various size resistors.

    2) Set the unused pins as inputs and pull them either up or down through various size resistors.

    Either way avoids floating inputs.

    In either case, I'd suggest not connecting the pins directly to Vdd or Vss. By using pullup or pulldown resistors, you have future possibility of using the pins as either inputs or outputs without having to cut wires or PCB traces. This also avoids the risk of a bug being able to flip an input pin to an output and then connect ground and Vdd by trying to drive the wrong state onto the pin.

    While it's always good to learn from one's mistakes, it's much easier to learn from the mistakes of others.
    Please don't PM me with technical questions. I'll be quite happy to help (if I can) on the forums.
    #5
    jankop
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2004/11/05 14:12:45
    • Location: Brno, Czech republic
    • Status: offline
    RE: Unused pins 2004/12/17 08:58:11 (permalink)
    0
    bob_barr ,
    can you tell me please, why pull output up or down?
    #6
    bob_barr
    Super Member
    • Total Posts : 5428
    • Reward points : 0
    • Joined: 2003/11/07 12:35:23
    • Location: Morgan Hill, CA
    • Status: offline
    RE: Unused pins 2004/12/17 09:08:19 (permalink)
    0
    can you tell me please, why pull output up or down?

    Using a pullup or pulldown resistor guarantees that, even if a program bug flips an output pin to be an input, you won't ever have the pin floating. (If board space or parts cost is critical, they could probably be omitted.)

    While it's always good to learn from one's mistakes, it's much easier to learn from the mistakes of others.
    Please don't PM me with technical questions. I'll be quite happy to help (if I can) on the forums.
    #7
    jankop
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2004/11/05 14:12:45
    • Location: Brno, Czech republic
    • Status: offline
    RE: Unused pins 2004/12/17 09:17:16 (permalink)
    0
    Using a pullup or pulldown resistor guarantees that, even if a program bug flips an output pin to be an input, you won't ever have the pin floating. (If board space or parts cost is critical, they could probably be omitted.)

    Yes, but it is'nt good in small battery powered applications too.
    Thanks
    #8
    dchisholm
    Super Member
    • Total Posts : 3805
    • Reward points : 0
    • Joined: 2003/12/14 15:30:12
    • Location: St Louis Mo
    • Status: offline
    RE: Unused pins 2004/12/17 09:19:46 (permalink)
    0
    Pretty much the same practice, but it's complicated by the versatility of microcontrollers like the PIC. Good practices for 74HCxxx logic are also good for PIC's.

    All input pins should have their logic states defined. For a variety of reasons, it's considered poor practice to connect a PIC pin directly to Vdd (power rail) or Vss (return). Instead, these connections are made via pull-up or pull-down resistors. Some folks use values as low as 3.3K or 4.7K; 10K to 22K is a more common range; and some brave souls regularly specify 47K or even 100K. I don't think there's any advantage of pullups over pulldowns, since PIC inputs are CMOS. I sometimes wait until the PWB layout has started, and select pullup or pulldown based on whether the power or ground bus is more accessible from a particular pin.

    Many PIC's incorporate internal pull-ups on some of their pins. I have never relied entirely on these connections, because they must be activated (and can be de-activated) in software, and I know I've done some pretty dumb things in software from time to time.[:@]

    Output pins can be left unterminated. Pins used in oscillator circuits are special cases, and should be terminated as shown in the Data Sheet.

    Now for the complications. Most pins on most PIC's can be either inputs or outputs, again under software control. To preclude the possibility that some output pin might inadvertently become an input, and hang in an indeterminate logic state (or worse, oscillate due to some unanticipated feedback path), I always terminate outputs with a pullup/down resistor anyway.

    Some authorities recommend defining all unused pins as outputs, and omitting the pullup/down resistors. They seem to forget that the TRIS (port direction) registers default to "input" on powerup. You will therefore have unterminated inputs until your code gets around to defining them as outputs.

    This topic has been discussed in several forum threads over the last 6 months or so - if you can't find them with a "search", I might be able to help.
    #9
    bob_barr
    Super Member
    • Total Posts : 5428
    • Reward points : 0
    • Joined: 2003/11/07 12:35:23
    • Location: Morgan Hill, CA
    • Status: offline
    RE: Unused pins 2004/12/17 09:33:01 (permalink)
    0
    Yes, but it is'nt good in small battery powered applications too.

    As I said in my first post on this thread, everybody thinks their way is "the best way" for various reasons. I'm not going to get into a pointless argument on this issue. Do whatever works for your application.

    While it's always good to learn from one's mistakes, it's much easier to learn from the mistakes of others.
    Please don't PM me with technical questions. I'll be quite happy to help (if I can) on the forums.
    #10
    Guest
    Super Member
    • Total Posts : 80500
    • Reward points : 0
    • Joined: 2003/01/01 00:00:00
    • Location: 0
    • Status: online
    RE: Unused pins 2004/12/22 14:20:46 (permalink)
    0
    You're right, Bob. I thank you all for your replies. Most helpful. I think I'll stock up on 10k resistor packs. wink
    #11
    Jump to:
    © 2019 APG vNext Commercial Version 4.5