|
|
View previous topic :: View next topic |
Author |
Message |
M0KHZ
Joined: 14 Feb 2008 Posts: 18 Location: Cumbria
|
Random reset - 18F4550 |
Posted: Sun Feb 24, 2008 11:07 am |
|
|
Hi Guys, this issue is bugging the life out of me!
I've stripped the code down to basics, and I'm still getting a semi random reset.
The MCLR is being pulled up to 5V with a 3K3 resistor (have changed this between 1K and 10K - no difference found).
With JUST the code below, while executing the forever loop, every 11 to 16 loops (never greater than 16) the program resets!
Any ideas what I am doing wrong?
Code: |
// Test code to try to establish why I'm getting a semi-random reset
// MCLR pulled up via a 3K3 resistor to 5V.
// Code writen for CCS 'C' compiler - Version 3.249
#include "C:\Program Files\PICC\dev code\Mag_Loop_Controller\18F4550.h"
#use delay(clock=10000000)
#fuses NOPROTECT, EC_IO, NOBROWNOUT, NOPUT, NOCPD, NOSTVREN,
NODEBUG, NOLVP, NOWRT, NOIESO, NOFCMEN, NOPBADEN, NOWRTC, NOEBTR,
NOEBTRB, NOCPB, MCLR, NOXINST, PLL1,
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7)
void main()
{
printf("\nProgramme running - you should only see this message once!");
printf("\nIf you see this again you have a serious problem!\n");
while (true) {
printf("\nRS232 comms are functioning\n");
printf("Next character stream in 10 seconds\n");
delay_ms(10000);
// every 11 - 16 loops (never greater than 16) the program resets!
// it's driving me nuts!
// what am I doing wrong?
}
} |
Frustrated and confused !
Kevin - M0KHZ |
|
|
esa
Joined: 31 Jan 2008 Posts: 19
|
|
Posted: Sun Feb 24, 2008 11:20 am |
|
|
Dear kevin,
I'm not sure ( because , I'm a beginner ).
But, you can add this :
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
Specialy, if you use a crystal at high speed 10-20 Mhz.
This directive is to drive the quartz with more current and avoid problem of stabitlity.
Regards
Eric |
|
|
M0KHZ
Joined: 14 Feb 2008 Posts: 18 Location: Cumbria
|
|
Posted: Sun Feb 24, 2008 11:24 am |
|
|
Hi Eric
I'll try the NOWDT, and let you know.
I forgot to mention I'm using an external clock (gps derived 10Mhz) hence the #fuses EC_IO statement.
Back shortly
Kevin - M0KHZ |
|
|
M0KHZ
Joined: 14 Feb 2008 Posts: 18 Location: Cumbria
|
|
Posted: Sun Feb 24, 2008 11:57 am |
|
|
Hi Eric
I've modified the code to include #fuses NOWDT
and it's been running for nearly half an hour perfectly!
Looks as though this has been the problem all along.
I'll keep it running overnight and look at the output in the morning, I have high hopes !
Once again, something valuable learned today
Thanks for the help and support.
Kevin - M0KHZ |
|
|
|
|
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
|