I/O Pin status during startup


+ Reply to Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Jul 2024
    Posts
    28


    Did you find this post helpful? Yes | No

    Default Re: I/O Pin status during startup

    Hi Acetronics2,
    thanks for your reply.

    To be accurate, during power on, these I/Os turn on and off (and then stay off) very quickly (like a flash). The idea is to stop that high-low behavior.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default Re: I/O Pin status during startup

    Quote Originally Posted by PaulMaker View Post
    Hi
    To be accurate, during power on, these I/Os turn on and off (and then stay off) very quickly (like a flash). The idea is to stop that high-low behavior.
    Simple answer- you cannot do that.

    You should design your project with active low outputs to account for the High-Z input state at power on. Almost every microcontroller, I know, behaves similarly unless there is special hardware built in to retain a certain state at power on. Till such time as your program code runs, the microcontroller IO pins are kept in a High-Z state to prevent unintentional damage to itself.

  3. #3
    Join Date
    Jul 2024
    Posts
    28


    Did you find this post helpful? Yes | No

    Default Re: I/O Pin status during startup

    Greetings,

    thank you Jerson for your reply.

    Regarding "design your project with active low outputs to account for the High-Z input state at power on", what do you mean exactly?
    If, for example, I only have LEDs on these I/Os, what can I do?





  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: I/O Pin status during startup

    if you have leds that illuminate on power up before the pins have been set as outputs then you are doing something very odd
    or you have broken something

    schematic and code ?
    Warning I'm not a teacher

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: I/O Pin status during startup

    Yeah, this sounds very strange.

    As others have said, after power on and reset (POR) all the pins come up as inputs so they should not go either high or low for any duration. Leakage current into the pin is MUCH less than a uA (200nA max) so basically "any" sort of resistance (ie several mega Ohms) to either Vdd or Vss will pull the pin to that.

    And it doesn't really matter what you do with the PORT or LAT registers until you also clears the TRIS bits in questions. Ie, at power up the pins are inputs (high impedence), then you "preset" their default state(s) by writing to PORT or LAT and finally you clear the corresponding TRIS bits to enable the output drivers.

    The 18F2580 have pull-ups on PORTB (and PORTB only it seems). They are disabled on POR so they should not be able to pull the pin high. The current sourced thru the pull-up resistor is between 50 and 400uA so even WITH them enabled I don't think you'd see a LED light up.

    More details please...

  6. #6
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default Re: I/O Pin status during startup

    Quote Originally Posted by PaulMaker View Post
    Greetings,

    thank you Jerson for your reply.

    Regarding "design your project with active low outputs to account for the High-Z input state at power on", what do you mean exactly?
    If, for example, I only have LEDs on these I/Os, what can I do?




    Many a times, I have used an I/O pin to drive a relay through a transistor. So, assuming I need an active high output to turn on the relay, I have observed (across microcontroller families) that the relay flicks on for the fraction of a second till the program code takes control and the pin get set to the off - state of the relay (0). So, the ideal way to resolve such a situation is to ensure that the relay turns on only when the I/O pin is made to output a LOW.

    In case of driving an LED from an IO pin, my thinking is biased with the TTL logic output specificiation where the sinking current limit is larger than the sourcing current limit. So, I usually tend to use LEDS with an active low output configuration. The IO port has to be low for the LED to turn on. This spec thing is no longer true with the current generation of microcontrollers except the 8051 family dies from old.

    So, as a best practice, I tend to use active low outputs for any device that needs to be turned on.

Similar Threads

  1. How can I store the status of a pin?
    By Stargazer3141 in forum General
    Replies: 2
    Last Post: - 3rd December 2010, 22:59
  2. Issue with 16F88 startup
    By Plcguy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 21st October 2010, 15:11
  3. Startup on power up pic16f886
    By CESSKO in forum Test Area
    Replies: 0
    Last Post: - 14th April 2010, 12:26
  4. 7 second delay on startup
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd March 2006, 01:46
  5. 12F683 Startup
    By GregK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th March 2005, 00:25

Members who have read this thread : 20

You do not have permission to view the list of names.

Posting Permissions

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