|
|
View previous topic :: View next topic |
Author |
Message |
bwelch
Joined: 09 Nov 2003 Posts: 2 Location: Oklahoma State Univ
|
16f877A reset problem |
Posted: Sun Nov 09, 2003 10:48 pm |
|
|
I would like help troubleshooting a 16F877A problem. I have successfully loaded the bootloader with the bit configurations found at the bottom of the post and downloaded the 'hello world' program, also found below. However, the PIC seems to be resetting itself automatically, at regular time intervals (about 1-2 secs after printing 'hello world' to the screen.). When running longer programs, the PIC will reset itself in the middle of executing a program. I have read many posts about the #fuses options and have tried many variations.
As you can see below, I have selected NOWDT in the bit configurations. I have capacitors in front of all my power pins, and looked at the MCLR on a scope--it seems to stay high. I tend to believe the problem is either in the 16F877A.h file or in the bootloader. I get the bootloader and downloader from www.microchipc.com. Also, I have modified the header file to reserve space for the bootloader.
Thanks for any suggestions.
Bit Configuration:
Oscillator HS
Watchdog Timer Off
Power Up Timer On
Code Protect Off
Brown Out Detect On
Low Voltage Program Disabled
Data EE Protect Off
Flash Program Write Off
Background Debug Disabled
Test Program:
#include<16f877a.h>
#include<stdio.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7)
void main(void)
{
printf("hello, world\n\r\n\r");
} |
|
|
Pete Smith
Joined: 17 Sep 2003 Posts: 55 Location: Chester, UK
|
Re: 16f877A reset problem |
Posted: Mon Nov 10, 2003 3:52 am |
|
|
bwelch wrote: | I would like help troubleshooting a 16F877A problem. I have successfully loaded the bootloader with the bit configurations found at the bottom of the post and downloaded the 'hello world' program, also found below. However, the PIC seems to be resetting itself automatically, at regular time intervals (about 1-2 secs after printing 'hello world' to the screen.). When running longer programs, the PIC will reset itself in the middle of executing a program. I have read many posts about the #fuses options and have tried many variations.
As you can see below, I have selected NOWDT in the bit configurations. I have capacitors in front of all my power pins, and looked at the MCLR on a scope--it seems to stay high. I tend to believe the problem is either in the 16F877A.h file or in the bootloader. I get the bootloader and downloader from www.microchipc.com. Also, I have modified the header file to reserve space for the bootloader.
Thanks for any suggestions.
Bit Configuration:
Oscillator HS
Watchdog Timer Off
Power Up Timer On
Code Protect Off
Brown Out Detect On
Low Voltage Program Disabled
Data EE Protect Off
Flash Program Write Off
Background Debug Disabled
Test Program:
#include<16f877a.h>
#include<stdio.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7)
void main(void)
{
printf("hello, world\n\r\n\r");
} |
Try modifying the code so that as well as printing "Hello World", it also shows the restart cause.
This may help you narrow down why it's restarting.
HTH
Pete. |
|
|
Jos
Joined: 15 Sep 2003 Posts: 4
|
|
Posted: Mon Nov 10, 2003 11:53 am |
|
|
Make sure you use the right programmer with the right settings! You probably use 16F84 settings. The programmer only programs the first part of your code. The result is a constantly restarting F877!
Greetz
Jos |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 10, 2003 3:18 pm |
|
|
What programmer are you using ?
Can you guarantee that the PIC is really being programmed for NOWDT ?
And, the same thing for NOLVP.
Your programmer may need a firmware update, in order to be
able to program an "A" part. You should verify that you have
the latest firmware and the latest application program.
There is one problem with your test program. It will fall off the
end of main() and go to sleep, because CCS puts a hidden Sleep
instruction at the end of main(). Possibly, this could be causing
some of the problems you're seeing. You should put a while(1)
statement in your code to prevent this. Example:
void main(void)
{
printf("hello, world\n\r\n\r");
while(1); // Prevent PIC from going to sleep
}
Also, after doing that, you can remove the extra \n and \r
that you added, to solve the problem of the last two chars
being cut off. With the while(1) statement in there, that
problem won't occur anymore.
-----------
Or, you could be having the problem described in the
following link, in which case you should test your board
with a non "A" chip.
http://www.ccsinfo.com/forum/viewtopic.php?t=17437 |
|
|
DragonPIC
Joined: 11 Nov 2003 Posts: 118
|
interrupts? |
Posted: Thu Nov 13, 2003 3:53 pm |
|
|
check your brown out level.
Make sure your interrupts are disabled. If an interrupt has not where to interrupt to, could cause problems. |
|
|
bwelch
Joined: 09 Nov 2003 Posts: 2 Location: Oklahoma State Univ
|
unresolved |
Posted: Thu Nov 13, 2003 4:51 pm |
|
|
Thanks to everybody for the suggestions. I tried everything everybody suggested and still couldn't resolve the problem. We bit the bullet and ordered 877's, to replace the 877A's...everything works smoothly on them (same code, same burner, bootloader and downloader from the same site, etc).
I hate giving up on a problem, but for the sake of the project moving forward we had to "cut our losses". I've also seen a lot of problems with individual I/O pins in the previous posts, and didn't want to resolve the original problem just to encounter this one.
Just to know, are there people on this forum using the 877A's without any problems?
Thanks again,
Brian
BW |
|
|
|
|
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
|