Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

16F877A inconsistant startup time

Status
Not open for further replies.

shsn

Junior Member level 3
Joined
Nov 28, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,523
Hi,

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.
 

shsn

Junior Member level 3
Joined
Nov 28, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,523
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.

Cheers.

View attachment test.BMP

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

shsn

Junior Member level 3
Joined
Nov 28, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,523
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 :)
 

kabeer02

Full Member level 5
Joined
Nov 23, 2012
Messages
301
Helped
57
Reputation
114
Reaction score
54
Trophy points
1,308
Location
yamasukro
Activity points
2,475
It is necessary to connect 10k to the MCLR of you micro otherwise it keep working in random.
 

keith1200rs

Super Moderator
Staff member
Joined
Oct 9, 2009
Messages
10,877
Helped
2,064
Reputation
4,128
Reaction score
1,597
Trophy points
1,403
Location
Yorkshire, UK
Activity points
57,276
The behavior of the MCLR pin is usually defined by the configuration bits (which you haven't shown).

Keith
 

keith1200rs

Super Moderator
Staff member
Joined
Oct 9, 2009
Messages
10,877
Helped
2,064
Reputation
4,128
Reaction score
1,597
Trophy points
1,403
Location
Yorkshire, UK
Activity points
57,276
Tahmid,

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.

Keith
 

shsn

Junior Member level 3
Joined
Nov 28, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,523
Thanks all for the suggestions, adding a 10K resistor worked perfectly.
The PIC powers on straight away now. Thank you :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top