View previous topic :: View next topic |
Author |
Message |
jvalencia
Joined: 18 Mar 2005 Posts: 5
|
pic going down randomly |
Posted: Sun Apr 03, 2005 4:43 am |
|
|
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
|
|
Posted: Sun Apr 03, 2005 7:40 am |
|
|
Post the #fuses statement, crystal speed, capacitor values. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Sun Apr 03, 2005 9:51 am |
|
|
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
|
|
Posted: Sun Apr 03, 2005 9:56 am |
|
|
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
|
|
Posted: Sun Apr 03, 2005 10:03 am |
|
|
sorry, forgot to login. Without capacitors happens the same thing.
I don't know what's happening |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Sun Apr 03, 2005 10:48 am |
|
|
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
|
|
Posted: Sun Apr 03, 2005 11:01 am |
|
|
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
|
|
Posted: Tue Apr 05, 2005 1:01 pm |
|
|
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
|
|
Posted: Fri Apr 08, 2005 7:33 am |
|
|
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 |
|
|
|