PDA

View Full Version : 876A startup issue with PortC



modifyit
- 28th March 2007, 14:28
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

mister_e
- 28th March 2007, 14:36
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.

modifyit
- 28th March 2007, 14:59
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

paul borgmeier
- 28th March 2007, 15:10
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.

modifyit
- 28th March 2007, 15:17
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.

peterdeco1
- 28th March 2007, 16:07
I had the same problem with a 16F819. I turned off the powerup timer & it went away.

paul borgmeier
- 28th March 2007, 21:53
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.

Archangel
- 29th March 2007, 07:05
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

modifyit
- 3rd April 2007, 13:44
FYI,

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

Thanks again!

paul borgmeier
- 3rd April 2007, 14:10
Glad it worked - cheers! (or should I say glad you were able to modifyit)