![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
valemike Guest
|
Several PIC resets upon an initial plugging in of power... |
Posted: Tue Mar 15, 2005 8:43 am |
|
|
When i plug in power to my PIC (transformer 12Vac secondary to an LM340-T), the pic goes thru a power-on reset (of course).
void main(void)
{
printf ("PIC reset.\r\n");
...
}
I noticed that i will get the above string up to 5 times while powering up once. I have BOR enabled to 4.2V, WDOG off, PUT on, yet i still get resets. By inspection, the RCON register tells me that the additional resets are NOT due to POR nor BOR.
Would they thus be due to a slow MCLR rise time? |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Tue Mar 15, 2005 9:11 am |
|
|
That's odd. I don't know if a slow MCLR rise time could cause that, but I'm wondering how big your power supply capacitors are?
Maybe one possibility is that your circuit might be drawing a little more current than your supply caps can handle while they're charging - immediately after you plug in the supply. Depending on your supply and whether it uses a full or half bridge rectifier, the input voltage to your regulator may be falling low enough to cause a BOR?
Is it possible to wire in another cap to the supply, upstream of the regulator? Even if you just have to fudge it, just to see if the problem goes away. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 15, 2005 9:11 am |
|
|
Mike, you'll have to give us more information that that.
What's the PIC ? Can you post a small program (maybe
just a "Hello World") that demonstrates the problem ?
If we see the program (with the #fuses statement), and
also if you tell us the details of your MCLR circuit, we
might be able to help. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Tue Mar 15, 2005 9:29 am |
|
|
PCM programmer wrote: | Mike, you'll have to give us more information that that.
What's the PIC ? Can you post a small program (maybe
just a "Hello World") that demonstrates the problem ?
If we see the program (with the #fuses statement), and
also if you tell us the details of your MCLR circuit, we
might be able to help. |
PIC18F448
Code: |
#include <18F448.h>
#include "xslider_commands.h"
#fuses HS,NOWDT,NOPROTECT,NOLVP,PUT
#use delay(clock=8000000)
//I actually manually set BOR to be 4.2V in MPLAB
void main(void)
{
int x;
for (x=0; x<10; x++)
{
//#ifdef MIKE_DEBUG
printf ("UNIVERSAL SLIDER RESET!!!!\r\n\r\n\r\n");
printf ("PIC_RCON = 0x%2.2X\r\n", PIC_RCON);
if (PIC_RCON == 0x1C)
{
printf ("POR Reset\r\n");
PIC_RCON |= PIC_RCON_POR;
PIC_RCON |= PIC_RCON_BOR;
}
else
{
printf ("Non-POR Reset\r\n");
}
//#endif
|
ARGHH!!!! THE DARN THING's in a FOR-LOOP!!!
Can someone please delete this thread! ![Rolling Eyes](images/smiles/icon_rolleyes.gif) |
|
![](templates/subSilver/images/spacer.gif) |
valemike Guest
|
|
Posted: Tue Mar 15, 2005 9:40 am |
|
|
newguy wrote: | That's odd. I don't know if a slow MCLR rise time could cause that, but I'm wondering how big your power supply capacitors are?
Maybe one possibility is that your circuit might be drawing a little more current than your supply caps can handle while they're charging - immediately after you plug in the supply. Depending on your supply and whether it uses a full or half bridge rectifier, the input voltage to your regulator may be falling low enough to cause a BOR?
Is it possible to wire in another cap to the supply, upstream of the regulator? Even if you just have to fudge it, just to see if the problem goes away. |
Newguy, okay, so besides my for-loop blunder, I was having spurious reset problems during runtime. (I'm running a motor). All these PWM spikes radiated in the air caused MCLR to get shaky (despite the fact that my motor drive is galvanically isolated). This caused resets in the PIC.
By putting in an external MCLR reset circuit (Figure 6-2 of the PIC18F448 datasheet), i seem to have gotten rid of the spurious reset problem. I guess the MCLR reset circuit filters the pin against spikes. |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Tue Mar 15, 2005 9:58 am |
|
|
I had a similar problem. I built myself a controller for a freezer (to keep my 10 kegs of beer at the right temp - why else? ) The first iteration was horrible (but so was the freezer). Every time this freezer cuts in/out, there is a huge spike on the mains. I know there is because I can actually hear the crackle/pop in my audio equipment.
Almost every time it applied power to the freezer (through a relay) or removed power, the resulting surge would trigger the PIC to reset. It was driving me batty!
I had to redo the pcb. Even though I had surge absorbers in the first one, they obviously weren't enough. I installed two MOVs, one on the mains, and another on the secondary of the supply transformer. Both of the MOVs were rated for 5 Joules (overkill, but I was annoyed). I also had an ICSP header on the pcb - the first one had a line to the MCLR/Vpp PIC pin which was parallel to one of the supply traces for about an inch. I redesigned the second one so that this line wasn't parallel to any supply traces at all.
The resulting product is very stable. No annoying resets, and it's been about a year since I built it. Burp. ![Cool](images/smiles/icon_cool.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|