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

Nested interrupts / Interrupt priority on PIC16Fxxx

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



Joined: 09 Feb 2009
Posts: 12

View user's profile Send private message

Nested interrupts / Interrupt priority on PIC16Fxxx
PostPosted: Thu May 07, 2009 5:26 am     Reply with quote

I want to respond to an IOC on a PORTA pin while in the RTCC interrupt.

Can interrupts be re-enabled inside an ISR?

If so, do I need to do anything special before exiting either the original ISR or the one that interrupted the original ISR?


Micro: PIC16F688
Compiler: PCM 3.235


Thanks
_________________
Calvin
Ttelmah
Guest







PostPosted: Thu May 07, 2009 7:30 am     Reply with quote

At heart, you can't....
The PIC _hardware_ disables the global interrupt flag, when the interrupt handler is called.
There is only one main interrupt vector, which is called when any interrupt event occurs. If the global interrupt was re-enabled, the _same_ vector would get called.
The PIC does not support re-entrancy (calling code inside itself), which this would imply...
Basically, you can only do this, by chosing a later PIC, that supports more than one interrupt hardware vector (PIC18)

Remember though, that there is nothing to stop you _polling_ the second interrupt flag inside the RTCC code. This will almost certainly be faster anyway...

Best Wishes
ckrusen



Joined: 09 Feb 2009
Posts: 12

View user's profile Send private message

PostPosted: Thu May 07, 2009 9:00 am     Reply with quote

Then why does the C compiler require designation of the ISR?
For example,
Code:
#INT_RTCC
vs
Code:
#INT_RA


Is that just for other micros that have seperate vectors?

Since the 16F688 only has one vector the interrupt source should really be checked against all the interrupt flags. That could be a whole lot clearer in the PIC datasheet.
_________________
Calvin
Ttelmah
Guest







PostPosted: Thu May 07, 2009 9:32 am     Reply with quote

CCS, doesn't really....

You can just use #INT_GLOBAL, and this replaces the 'master' interrupt handler.

What CCS does, is generate a 'hidden' master handler for you, that saves all the registers (All registers used inside the interrupt service routines need to be saved), then tests each interrupt bit, and calls the associated subroutine.

Even chips like the 80x86, only have a couple of 'real' interrupt levels, but what they then have is an external interrupt 'controller', which allows multiple inputs, with different priorities, and the chip hardware, then allows different vectors to actually be created by these chips, and vector you to different routines. These processors also have hardware stacks for user variables, so that code can be re-entrant.

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