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

Attention Interrupts !!!!!!!!!!!!!!!!!!!

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



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

Attention Interrupts !!!!!!!!!!!!!!!!!!!
PostPosted: Thu Apr 14, 2005 1:13 am     Reply with quote

Hi Friends,

after a bunch of hours searching for an missbehaviour in my programm I found the problem and I like to share with You my experience.

Normal working:

Programm displays time, changes every second based on an interrupt from a RTC Timekeeper. Int routine sets a flag which determines in the mainloop if the time display is to updated or not.

works perfect with ICD attached

works perfect when programming the chip (BTW 18F8720) with the IDC tool, starts running perfect.


BUT - after turning of the power and restarting it shows only 2 times a time change and then never - int is running !!!

This could be reproduced as often as you like !! Fortunatly !!!!!!!!


Problem was:

Weeks ago I implemented a int routine for Int_Ext1, but I didnt get the expexted result, so I decided to delete this function complete.

BUT I forgot to remove the Enable Int_Ext1 statement -----------------

This costs me about 12 hours searching !

I hope this posting is helpful for You out there.

best regards

Andreas
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Apr 14, 2005 4:48 am     Reply with quote

I had a similar experience once but because of small incremental steps I was lucky to find the cause of the problem faster.

Seeing I'm not the only person with this problem I'm thinking about requesting CCS for a new warning message. This warning message should pop up when a program enables an interrupt but has no handler defined.

Only the request for a new warning because there are situations possible where there is an interrupt handler hidden from the compiler. A programmer disliking the message can suppress it of using the #IGNORE_WARNINGS directive.

A possible limitation I can think of is that this warning can only be generated when the programmer enables an interrupt with the CCS specific enable_interrupts() function, i.e. enterrupts enabled by directly setting/clearing the configuration bits might be missed by this warning.

How about this proposal? Some suggestions for improvement before submitting this to CCS?
Andreas



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

PostPosted: Thu Apr 14, 2005 5:57 am     Reply with quote

Hi ckielstra,

its exactly what I was trying to put in a CCS Request.

Of course You cant get a solution for every tricky programmer, but at least
if You just get a warning would, especially to New C programmers, give a very helpful message.

Pls put this request to CCS

I still have another problem, where I know the workaround, but is still a dangerous way to go:

When specifing larger RAM Arrays You should take care to start at boundaries, like 0x100,0x200... failling to do this will cause in some strange results.

In my case I have a constant array in ProgrammFlash, works perfectly - unless You try to make a RAM Array NOT on Boundaries, then the reading results of the constant array is unpredictable !!!!

It filed this problem months ago to CCS but no reply !!!!

In my program I dont need the constant array anymore but I left it in just for the onlay reason, that when I am misstaken in RAM Arrays I can see imm at programstart - if constant output is okay fine if it is scrambled I know that I made a misstake in declaration on some other places.

Important is, that one has nothing to do with the other !!!!

best regards
Andreas


best regards

Andreas
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Apr 14, 2005 6:04 am     Reply with quote

ckielstra wrote:
Quote:

Seeing I'm not the only person with this problem I'm thinking about requesting
CCS for a new warning message. This warning message should pop up when a
program enables an interrupt but has no handler defined.

Yes I like the idea. Idea

Something like this:
Code:

#INT_EXT1
ext1_isr()
{
 // No statements. Empty     
}

Warning xx2: Default Interrupt handler implemented.

Code:

#INT_EXT1
ext1_isr()
{
  Led_On(Yellow);
}

Warning xx3: Interrupt handler user defined.



Code:

enable_interrupts(INT_EXT1);


Warning xx4: Interrupt INT_XXX enabled. Handler not defined
or
Warning xx5: Interrupt INT_XXX enabled. Handler defined by user

Warning xx6: Interrupt INT_XXX user defined but not used.


Warning xx7: Just a suggest !!! Very Happy

Humberto
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Apr 14, 2005 6:31 am     Reply with quote

This is not a warning but it would have helped solve your problem a little faster:

Quote:

#INT_DEFAULT


Syntax:
#int_default



Elements:
None



Purpose:
The following function will be called if the PICŪ triggers an interrupt and none of the interrupt flags are set. If an interrupt is flagged, but is not the one triggered, the #INT_DEFAULT function will get called.



Examples:
#int_default

default_isr() {

printf("Unexplained interrupt\r\n");

}


Andreas



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

PostPosted: Thu Apr 14, 2005 6:40 am     Reply with quote

Hi Mark,
Thank You for Your suggestion, I think I will put this code inmy standard
openening template for new projects.

A very good solution

thanks

Andreas
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