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 support@ccsinfo.com

16f877A reset problem

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



Joined: 09 Nov 2003
Posts: 2
Location: Oklahoma State Univ

View user's profile Send private message

16f877A reset problem
PostPosted: Sun Nov 09, 2003 10:48 pm     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger ICQ Number

Re: 16f877A reset problem
PostPosted: Mon Nov 10, 2003 3:52 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Mon Nov 10, 2003 11:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 10, 2003 3:18 pm     Reply with quote

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

View user's profile Send private message

interrupts?
PostPosted: Thu Nov 13, 2003 3:53 pm     Reply with quote

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

View user's profile Send private message

unresolved
PostPosted: Thu Nov 13, 2003 4:51 pm     Reply with quote

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
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