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 CCS Technical Support

possible processor problem

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



Joined: 11 Sep 2008
Posts: 44

View user's profile Send private message

possible processor problem
PostPosted: Wed Oct 29, 2008 7:00 am     Reply with quote

My PIC16f877a seems to be crashing and all the pins start to oscillate extremely fast (as seen on the Digital Analyzer).

This happens when I change code, it doesn't matter what is added or taken away.

It has just started to do this and I have been reprogramming it will success for about a month.

The chip is on a PCB that has given no troubles in the past.

Could the chip be going bad? It has been reprogrammed a lot but it is no where near the life expectancy of the program flash memory.

Also when this happens the voltage regulator seems to "whine" but when the power is reset everything is fine until it goes back into the oscillating state.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 7:56 am     Reply with quote

Your statement that the regulator starts to whine raises a red flag for me. Does your power supply rail oscillate as well? If so, it sounds like you don't have enough capacitance on Vcc to ground.
bignick270



Joined: 11 Sep 2008
Posts: 44

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 7:59 am     Reply with quote

everything is fine on the voltage rail.

I went and commented out a few things and got it working but the funny thing is i went and uncommented them out and added it back in and it works now...

Dang ghost need to get out of the devices lol
bignick270



Joined: 11 Sep 2008
Posts: 44

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 8:36 am     Reply with quote

One of the culprits happens to be when I run the function memset(channel1, 0, sizeof(channel1));

channel1 is a 100 element array. I am using memset to set the array back to 0's.

I also have tried using a for loop to run through each element and set it to 0 but the same thing also happens.

Any thoughts?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 8:58 am     Reply with quote

Quote:

My PIC16f877a seems to be crashing. Channel1 is a 100 element array.
I am using memset to set the array back to 0's.


Post the code that declares that array, and also post the memset
function for it.

http://www.ccsinfo.com/forum/viewtopic.php?t=27958&highlight=array+size
bignick270



Joined: 11 Sep 2008
Posts: 44

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 9:01 am     Reply with quote

i have already removed that code from my source file.

I took a look at the link you posted. I can declare the 100 element arrays without problem but I have to use #locate channel1 = 0xA0 after it so the compiler doesn't give me the out of memory error.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 10:13 am     Reply with quote

Quote:

I can declare the 100 element arrays without problem but I have to use
#locate channel1 = 0xA0 after it so the compiler doesn't give me the out
of memory error.

Look at the memory map for the 16F877A in the data sheet.
It's on page 17 (page 19 in the Acrobat Reader), and it's titled:
FIGURE 2-3: PIC16F876A/877A REGISTER FILE MAP
http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf
It shows there is only 96 continuous RAM bytes available in that location.
So if you tried to use the last 4 locations in that array, you would
overwrite the Indirect Register, PCL, TMR0, and Status. This would
certainly cause erratic behavior or a crash.


Quote:
I have already removed that code from my source file.

Remove anything else in the code that is similar to this.
bignick270



Joined: 11 Sep 2008
Posts: 44

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 10:18 am     Reply with quote

You are right sir. I double checked the memory map and opened my eyes and realized what my problem was.
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