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

Simple source code = Erratic behaviour

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 07, 2010 1:13 pm     Reply with quote

Quote:

The problem is that it occasionally prints garbage, stops to work, restarts

Consider these possible problems:

Hardware:

1. Improper MCLR circuit.
2. No bypass capacitors (100 nF, ceramic) on the Vdd pins.
3. Poorly regulated power supply.
4. Incorrect crystal circuit.
5. Poor solder joints (cracked, intermittent connections).

One quick way to check the hardware is to use a factory-built eval board
rather than your own breadboard. If the problem goes away, there is
likely something wrong with your breadboard.

Software:

1. Enabling GLOBAL interrupts while inside an #int_xxx routine.
2. Enabling the XINST fuse in an 18F PIC.
3. Writing past the end of an array, thus over-writing other variables.
4. Watchdog timer enabled, but restart_wdt() is not called often enough.

One quick way to find if it's a software problem is to start commenting
out parts of your code and see if the problem goes away. Disable
interrupts. Comment out any "weird" things that you're doing, such as
#build, High Ints, FAST ints, etc.
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Sun Mar 07, 2010 1:37 pm     Reply with quote

thanks for the response.
I am sure this is not HW related, I have tried different crystal oscillators, MCLR is disabled,

>>Comment out any "weird" things that you're doing, such as #build, High ints, FAST ints, etc.
I have already tried those.

>>XINST fuse
It is not possible to use "#fuses NOXINST" keyword when using PIC18F1220.
>>WDT
The watchdog is also disabled.

I am going to comment out some parts of the source code tomorrow. Anyway, the source code is very short - there is nothing which would cause those troubles (e.g. there are no arrays at all...). I highly suspect there is something wrong with the compiler.
I am also going to convert the project to, say, PIC18F2420.

However, can anyone replicate the issue?

Cheers
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

Sorted out
PostPosted: Mon Mar 08, 2010 9:07 am     Reply with quote

I have changed the PIC to 18F2420 and problem is sorted out.
Ttelmah
Guest







PostPosted: Mon Mar 08, 2010 9:43 am     Reply with quote

Obvious thing. Revision B1 silicon.
Look at the errata sheet.

Best Wishes
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Mon Mar 08, 2010 9:51 am     Reply with quote

Ttelmah wrote:
Obvious thing. Revision B1 silicon.
Look at the errata sheet.
Best Wishes

omg, piece of crap.
thanks
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