CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

pic going down randomly

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jvalencia



Joined: 18 Mar 2005
Posts: 5

View user's profile Send private message

pic going down randomly
PostPosted: Sun Apr 03, 2005 4:43 am     Reply with quote

I'm having a terrible issue, after several seconds/minutes the pic stop working without reason. If i touch the capacitors of the HS cristal, then it start working again. I've tried other capacitors and get the same result.

My pic is 16f819, have you been in this situation before?

thanks.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Apr 03, 2005 7:40 am     Reply with quote

Post the #fuses statement, crystal speed, capacitor values.
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Sun Apr 03, 2005 9:51 am     Reply with quote

I had a similar situation once. When I did the pcb, I accidentally routed the ground plane too close to the lines running to the crystal & the crystal caps. Because the ground plane was too close, it was adding enough stray capacitance to the crystal circuit to disable oscillation. I think that I had 33 pF caps in place originally; I swapped them out with 15 pF caps and the thing worked great after that.

Maybe try swapping out your caps with smaller ones, or perhaps even take them out altogether just to see what happens.
Guest








PostPosted: Sun Apr 03, 2005 9:56 am     Reply with quote

This is my header section:

Code:

#include <16F819.h>
#device adc=8
#fuses NOWDT,HS, PUT, NOMCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT
#use delay(clock=20000000)
#use fast_io(A)
#use fast_io(B)


crystal is at 20Mhz and i have 2 sets of capacitors, 15pf and 27pf[/code]
jvalencia



Joined: 18 Mar 2005
Posts: 5

View user's profile Send private message

PostPosted: Sun Apr 03, 2005 10:03 am     Reply with quote

sorry, forgot to login. Without capacitors happens the same thing.
I don't know what's happening
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Sun Apr 03, 2005 10:48 am     Reply with quote

It kind of sounds like your program is hanging. Are you using the watchdog? If you aren't, try enabling it. If the re-boots after you start to use the watchdog, then the program was hanging.

Can you toggle an output line or write a message to an lcd or spit something out the serial port (anything)? Set up a "heartbeat" signal that you can see/measure/whatever.

Also check the stack usage. If you look at the C/Asm listing, at the top of the file will be a message regarding usage of ram, rom, and the stack. The stack on the 16's is only 8 levels deep. You may have a stack overflow happening in your code.
jvalencia



Joined: 18 Mar 2005
Posts: 5

View user's profile Send private message

PostPosted: Sun Apr 03, 2005 11:01 am     Reply with quote

my code is very simple, only 1 external function with no recursivity.
The memory used is 25% rom and 13% ram.

I'll try to buy another chip this week to see if it's broken.
iowa_engineer
Guest







PostPosted: Tue Apr 05, 2005 1:01 pm     Reply with quote

I had a similar problem with my 18F452. It would freeze up and sometimes restart after a couple of seconds or minutes. I then put a 100uF capacitor between the +5 and GND near the PIC to decouple any noise that could reset the PIC and I have not any problem since. Any momentary spike from the voltage regulator is nullified by doing this. Maybe this wouldn't cause a freeze, but it does cause resets.
jvalencia_
Guest







PostPosted: Fri Apr 08, 2005 7:33 am     Reply with quote

iowa_engineer wrote:
I had a similar problem with my 18F452. It would freeze up and sometimes restart after a couple of seconds or minutes. I then put a 100uF capacitor between the +5 and GND near the PIC to decouple any noise that could reset the PIC and I have not any problem since. Any momentary spike from the voltage regulator is nullified by doing this. Maybe this wouldn't cause a freeze, but it does cause resets.


Yeah! that worked, i put 470uF capacitor and now it works flawlessly.
Omg, i have had a headache for a month or more
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group