586,082 active members*
3,758 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > PIC Programing / Design > what to do with unused pins on 16f84??
Results 1 to 13 of 13
  1. #1
    Join Date
    Jul 2007
    Posts
    78

    what to do with unused pins on 16f84??

    Hey people.
    The past months i was trying to program and compile some pic programs for the well known 16f84a.
    The question never really clear to my is...What to do with unused pins on it? Oh!, use pull-up/down resistors!!
    Well but i don't now exactly which to use in different situations.
    Right now i have almost finished my program but:
    Port a play as input and 2 pins unused.
    Port b play as output and 2 pins unused.
    Assuming that i now there are build in pull-up resistors on port b, but want to use external parts anyway...
    The questions are this:

    1- when should i use pull-up resistors on port a?
    2-When should i use pull-down resistor on port a?
    3- when should i use pull-up resistors on port b?
    4-When should i use pull-down resistor on port b?

    Also: What values are suggested? Or there it is some formula for calculate this?. For direct connection to pc parallel port are 4k7, 5k, or 10k Ohm suggested? (Those values are the most commons i find on the web always).Wich is the best value?

    Well that´s the questions. You may think that i´m a little newbie with this and you are right so forgive me. Also forgive the writing. I´m from Argentina and speak Spanish all days.

  2. #2
    Join Date
    Dec 2003
    Posts
    24221
    You may find alot of answers on the ChipMicro User forum also.
    http://www.microchip.com/forums/Default.aspx?
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  3. #3
    Join Date
    Jul 2007
    Posts
    78
    well i have searched the topic all over the web but not find any direct answer to this direct questions i made before.

    Again:
    when to use pull-up or down on port a if it is in or out?
    The same for port b.

    I know there is a lot of info but not so direct like i need.
    Let my remind that i´m a newbie on this of pic programing and already have my head rolling with the learning stage of it.
    Thanks!!

  4. #4
    Join Date
    Dec 2003
    Posts
    24221
    There is a nice tutorial on Nigel Goodwin site.
    http://www.winpicprog.co.uk/pic_tutorial.htm
    See the section on inputs and outputs.
    Although he changed the tutorial from 16F84 to the cheaper 16F628.
    The 16F84 sink and source as output for port A is source 80ma and sink 50ma.
    For port B it is source 150ma sink 100ma.
    So any pull up or pull down can be calculated at 5v.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  5. #5
    Join Date
    Jul 2007
    Posts
    78
    Okay man thanks for the link´s.
    I read it but can´t find more than this 5 or 6 lines about in-out conditions. not too much about pull-up/down resistors... or i miss it.
    If there is anyone who can reply these questions i made before i will be very happy.
    It is for using a stepper driver board i savaged from a HP scanjet 5100c scanner.
    For less than us$ 5 in components (pic 16f84, xtal, capacitors and all the rest) will make an interesting all-in-one stepper + driver + power supply. All of this in one board. Not to powerful but useful for small projects.
    Wen finished and tested will upload the pack on cnczone (PCB layout, hex files, pictures).

  6. #6
    Join Date
    Jun 2008
    Posts
    128
    I have not had any problem leaving a pin floating if it did not matter to the program.
    A floating input can read as 1 or zero.
    If you are not trying to squeeze out the very minimum current drain then to be safe tie pins to ground with 10k resistors. The difference in current draw will be very small.
    When developing a new project I run unused pins to an external pioint as I later will find a use for it and want to tie into it for testing new feature.
    I always run out of pins before running out of new features
    George

  7. #7
    Join Date
    Dec 2003
    Posts
    24221
    ....As George said.
    This is the link for general use of I/O.
    http://www.winpicprog.co.uk/pic_tutorial_extras.htm
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  8. #8
    Join Date
    Jul 2007
    Posts
    78
    Thanks George. For what i have read so far the best is to tie unused pins to ground with 10k resistor in the middle, right?
    The unused output pins will always be 0 and the inputs will not have any signal to go hight, so all of them should go to PULL-DOWN with 10k resistors.
    Like this:
    ground---10k resistor---unused input pin port a
    ground---10k resistor---unused input pin port b

    The --- means wire...

    I will use portA pins 0,1,2 as input, and portB 0,1,2,3,4,5 as output, but unused portA pins 3,4 and portB pins 6,7 will by pulled-down.
    Is that correct?

  9. #9
    Join Date
    Jun 2008
    Posts
    128
    ground---10k resistor---unused input pin port a
    ground---10k resistor---unused input pin port b

    That's right

  10. #10
    Join Date
    Aug 2005
    Posts
    52
    Microchip PICs use FET transistors. FET transistors draw the most current when they are switching states from high to low (or reverse). Therefore, to stop the extra quiescent current draw from floating and unused INPUTS; They should be tied either high or low with a resistor. The default configuration for pins are input. You do not need to pull-up or pull-down OUTPUT pins.

    Just my opinion.

  11. #11
    Join Date
    Jul 2007
    Posts
    78
    Quote Originally Posted by Megahertz View Post
    Microchip PICs use FET transistors. FET transistors draw the most current when they are switching states from high to low (or reverse). Therefore, to stop the extra quiescent current draw from floating and unused INPUTS; They should be tied either high or low with a resistor. The default configuration for pins are input. You do not need to pull-up or pull-down OUTPUT pins.

    Just my opinion.
    "You do not need to pull-up or pull-down OUTPUT pins" you say?

    Thats right. output pins dont need pull-up/down resistors because they are at 0 volts all the time and will be like that ALWAYS.
    So the the other question in my mind as beign answered?:
    unused input pins should be pulled down with 10k resistors, and NO NEED FOR ANYTHING ON OUTPUT PINS?

  12. #12
    Personally, I leave all of my un-used PIC pins floating. If I am not polling them in firmware for a state change to cause somthing to happen, I don't care what they are doing. If you never check the state, you should'nt have them affect anything. I also avoid pulling them high or low in cases where I might have for example the lower nibble of PORTB used and the upper nibble unused and I just want to read the entire port with somthing like:

    Code:
    unsigned  char x;
    
    x = PORTB;
    If any of the upper nibble were pulled high, I would get a value from PORTB that was higher than 16. THIS IS JUST AN EXAMPLE. Of course, I could mask those top nibble bits, but that is another line of code

    Just my $0.02
    Jason
    RPC Electronics, LLC - www.rpc-electronics.com

  13. #13
    Join Date
    Jul 2007
    Posts
    78
    Thanks for your reply man.
    now take a look at this another:
    http://www.cnczone.com/forums/showth...347#post695347

Similar Threads

  1. 16F84 7 segment display
    By Razer in forum PIC Programing / Design
    Replies: 8
    Last Post: 06-10-2009, 05:27 PM
  2. DAKENG u-2 16f84 stepper translator
    By vacpress in forum PIC Programing / Design
    Replies: 2
    Last Post: 12-13-2005, 02:58 PM
  3. New unused DC Servo Controller...
    By Dave's_Not_Here in forum Servo Motors / Drives
    Replies: 4
    Last Post: 06-07-2005, 09:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •