Confused about what to do with unused I/O Pins

Discussion in 'Embedded Systems and Microcontrollers' started by ke5nnt, Mar 17, 2013.

  1. ke5nnt

    Thread Starter Active Member

    Mar 1, 2009
    I suppose this question is probably generic to PIC MCUs, but my current project is using the PIC12F629. I'm confused on whether there is a "proper" practice for what to do with extra I/O pins that you don't need.

    My project requires GP0 and GP4 to be outputs and GP2/INT to be an input. The datasheet for the device doesn't specify what to do with unused pins, but I notice that the value on reset for the TRISIO register sets them all at inputs by default. Assuming that the unused pins were not tied to anything, wouldn't this leave them as floating inputs? My understanding is that this is a bad thing.

    A thread on the microchip website had made mention that
    Okay, so set the unused pins as outputs and set as 0 in the port register. Sounds easy, except that on the PIC12F629, GP3 is input only. This basically forces a floating input on GP3 unless you actually use it for an input.

    So, what would be the optimal solution for what to do with the unused ports? Thanks.
  2. JohnInTX


    Jun 26, 2012
    Set them to outputs and write '0' to them.

    Leave them as inputs and tie to Vdd/GND

    Best: Pull them up / down with a 10K -68K resistor. This will keep you from driving into a short or the supply if you config them wrong or the program goes nuts and hammers the TRIS register(s). It also keeps from having unconnected pins which can introduce noise and are more succeptable to ESD when handling the boards (although PICs are pretty tough).

    The default as input (or analog input as applicable) to prevent the IO contentions that would happen if they were outputs at power up.

    If you have a dedicated input and no space for pullups you can tie it to an output.

    What you decide will depend on space, cost , how easy you want it to be to modify IO after building a proto board etc.
    Last edited: Mar 18, 2013
    ke5nnt likes this.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    Take a look here 2.pdf at page 2-4.
    ke5nnt likes this.
  4. ke5nnt

    Thread Starter Active Member

    Mar 1, 2009
    Thank you both for your responses.