Pin initialization question


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Pin initialization question

    I like to set the IOs right after the configuration registers (fuses).
    That way you are sure what the chip is doing while everything else is settling in.
    Give it a try...
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Pin initialization question

    Hi,
    Looking at table 3-2 in the datasheet you can see that the default state of PortC (and the other Port regsiters) is unknown at power up, so one pin being high and another low is to be expected. If you need them to be in specific states when powering up you need to make sure to set them. However, you might considder setting PORT before TRIS - otherwise there might be a short pulse on the output between the output driver being turned on and actually being set.

    /Henrik.

  3. #3
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: Pin initialization question

    As it turns out, the issue was actually coming from a combination of code and the unpredictability of an external IC the PIC is interfaced to. It appeared as if it was occurring at power-up, but a carefully placed pause statement illustrated otherwise. I've modified the code as per your suggestions anyway as they seem like good practice. Thanks Dave and Henrik for the tips.

    Regards,

    Troy.

Members who have read this thread : 0

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