Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

16F877A inconsistant startup time

Not open for further replies.


Junior Member level 3
Nov 28, 2012
Reaction score
Trophy points
Activity points

I'm having an issue with PIC16F877A where it starts up;
  • after significant amount of time, maybe 15 seconds, when it has been powered down for few minutes.
  • after about 0.5 seconds when powered off while it's running, then powering it on again quickly.

I tried with both PICkit 2 and regulated 5V and tried removing the load capacitors which are 33pF with 20MHz crystal.
What could be causing inconsistent start up time?

Thank you.

Upload your circuit diagram. It sounds like the problem is caused by capacitance either on the power line or MCLR.

Upload your circuit diagram. It sounds like the problem is caused by capacitance either on the power line or MCLR.

Thanks for prompt reply,

Here is my circuit diagram, all I do is connect the PICkit 2 header directly to the corresponding pins on 16F877A.
I've read that capacitors connected to the crystal oscillator determines the start up time but I don't think that is causing this.
Regardless I attached the screenshot.


View attachment test.BMP

And here's the code that I've used,
void main() {
     PORTC = 0;
     PORTD = 0;
     TRISC = 0;
     TRISD = 0;
     for(;;) {
             PORTC = 0x00;
             PORTD = 0x00;
             PORTC = 0xFF;
             PORTD = 0xFF;

Are you simulating on Proteus? Did you try on hardware?

Connect MCLR to VDD through a 10k resistor. Use current limiting resistors in series with each LED. Use 330R.

Yes, I'm using Proteus. It works when simulating as expected but on hardware, as stated in the original post,
there's an unknown delay and inconsistent start up time before PIC starts executing the instructions.
I will follow your advice and make changes to the circuit.

Just out of curiosity, if MCLR is not connected to anything wouldn't it mean it's LOW or 0V?
Any particular reason for additional resistor for MCLR?

Cheers :)

Not connecting MCLR to VDD does not mean that it is low. It means that it is floating. Keeping an input pin floating is never a good idea.

It is necessary to connect 10k to the MCLR of you micro otherwise it keep working in random.

The behavior of the MCLR pin is usually defined by the configuration bits (which you haven't shown).



Thanks, I didn't know specifically about that part number.

A useful tip for any PIC is to look for the 'minimum connections' diagram for the device (if there is one), usually in an early section of the datasheet. That will show which capacitors and resistors are required.


Thanks all for the suggestions, adding a 10K resistor worked perfectly.
The PIC powers on straight away now. Thank you :)

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to