876A startup issue with PortC


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2005
    Posts
    96

    Default 876A startup issue with PortC

    When the pic16f876a starts up Pins C.1 and C.2 go high for a split second before returning to the desired low state. Does anyone know if this is just the nature of this chip, or if there is a register I can change to keep this from happening.

    When I watch the port in a simulator program I can see the pin being held high on startup, so I'm guessing it is not a hardware issue.

    For reference I have the following port initialization at the beginning of the code:

    PORTC=%00000000
    TRISC=%00000000

    Thanks for any insight

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's no why this happen in real life unless your crystal is out of spec... let's say 4Khz instead of 4Mhz ... or you have a bunch of latency before your PORT initialisation. If they are located at the top of your code, few mSec could be the worst delay (Brow out detect, Power up timer...)

    on a Sim, ROFL, everything is possible so far.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    Thanks for the quick response,

    I've tried this on a 866 chip as well using its internal oscillator with the same results.

    Are you saying that until the chip's oscillator settles or the Brown Out Detect Power Up Timer (which I am using) starts the pic that these pins are going to be high no matter what?

    My issue is I am driving a mosfet with these pins and the split second startup issue causes the mos to conduct which is not desirable if I can help it.

    Is there anyway to force the port definition to be the first thing that happens in the code other then making it the first item in the pbp code?

    Thanks again

  4. #4
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    All pins are inputs on power up - how about adding weak pull-downs to these pins to hold them low - you can then take charge with code. In this manner, they will be low during the power up process.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  5. #5
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    I don't have a week pull down, so I will definitely be trying that.

    What has me confused is the simulator showing the pin being high.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    I had the same problem with a 16F819. I turned off the powerup timer & it went away.

  7. #7
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    PORTC = xxxxxxxx on POR or BOR (see datasheet as Skimask would say)
    where x = unknown (versus a known 1 or 0)

    Your simulator is probably set to let unknows be high since it has to be one or the other.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default 1 obscure idea

    Quote Originally Posted by modifyit View Post
    When the pic16f876a starts up Pins C.1 and C.2 go high for a split second before returning to the desired low state. Does anyone know if this is just the nature of this chip, or if there is a register I can change to keep this from happening.

    When I watch the port in a simulator program I can see the pin being held high on startup, so I'm guessing it is not a hardware issue.

    For reference I have the following port initialization at the beginning of the code:

    PORTC=%00000000
    TRISC=%00000000

    Thanks for any insight
    While I believe Paul hit the Duck when he said the simulator had to make a decision as to startup status . . . I was thinking about the order of listing PORTC and TRISC, it seems to me you should tell the program to make the ports outputs before driving them low. <B> and maybe I'm just talking out of my hat!</B>
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    FYI,

    I finally got around to soldering on that pull-down and it solved my problem.

    Thanks again!

  10. #10
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Glad it worked - cheers! (or should I say glad you were able to modifyit)
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. MY FIRST scrolling 8X8 LED
    By earltyso in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th August 2008, 16:23
  2. How do I configure the PIC16F737?
    By LinkMTech in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th November 2007, 23:05
  3. A little DTMF help
    By Travin77 in forum mel PIC BASIC Pro
    Replies: 48
    Last Post: - 30th May 2006, 01:31
  4. 18F1320 ... Strange Memory
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 43
    Last Post: - 9th April 2006, 09:55
  5. Wierd sleep issue
    By orca in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th March 2006, 22:06

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