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

Interrupt Priority

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



Joined: 18 Nov 2005
Posts: 3

View user's profile Send private message

Interrupt Priority
PostPosted: Mon Jun 12, 2006 1:14 pm     Reply with quote

Hello,
I am using several different interrupts in my code for PIC16F877A.
One of them is #INT_EXT.
I would like to set up this interrupt with highest priority.
It says in the C Compiler Reference Manual to use keywords HIGH and FAST, but there is no explanation how, and there is no example either.

How do I do this?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 12, 2006 1:28 pm     Reply with quote

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=8271&highlight=priority
Ttelmah
Guest







PostPosted: Mon Jun 12, 2006 3:04 pm     Reply with quote

HIGH, and FAST, only apply to the 18 chips.
The manual does say that these only apply to the PCH compiler (which is the compiler vesion for these latter chips), but doesn't explicitly say that the ability is physically 'not there' on the older chips.
On the 16 chips, there is only one actual 'level' of interrupts, and all you can do is in the global handler, change the order in which the interrupts are actually tested.The statement for this is #priority, followed by the interrupts names in use, in the order you want them checked. Alternatively, if this statement is not present, the interrupts are scanned in the order that their handlers are defined in the code.
However you are going to find that the delays will be very significant. If (for instance), the code just enters another interrupt handler, and then the event triggers, the code has to complete the whole of this handler, return from it, including restoring all the saved registers, then execute another interrupt call, save the registers again, and finally execute the required handler...
Even on chips which support hardware priorities (which is what 'high' is designed to handle), there are caveats, since on most (all?), if high priority interrupts are enabled, INT_EXT, will always be 'high'. In your case this would not matter, but for many applications this can be a pain.
I'm afraid your only way to get hardware interrupt priorities, is to upgrade your chip (and compiler, assuming you don't have PCH), to a 18F equivalent.

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