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

Same interrupt different ISR

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



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

Same interrupt different ISR
PostPosted: Wed Nov 28, 2012 8:00 am     Reply with quote

Hi,

Is it possible to have different ISRs for the same interrupt?

I would like to use for example: an ISR for TMR0 while executing one function, and a Different ISR for TMR0 in another function.

Timing is "critical" so I'd like to avoid using conditional statements inside the ISR.

I'm using _TMR0 + Int on Change_ as a crude Capture/Compare.

Oone function captures, the other compares, thus the need for different ISRs.

Is it possible?

Thanks
G
_________________
CCS PCM 5.078 & CCS PCH 5.093
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Wed Nov 28, 2012 8:30 am     Reply with quote

No.
However the time cost of a single bit flag and jump, is just two instruction times. Compared to the overhead of calling an ISR (typically 60+ instructions to enter and exit), this is insignificant.
Code:

int1 use_standard_handler=TRUE;

#INT_TIMER0
void timer0_tick(void) {
    if (use_standard_handler) {
        //standard code
    }
    else {
        //other code
    }
}

It is a single bit test instruction and jump.

The jumps to the handler code, are done from ROM. You could use a RAM based table by re-writing INT_GLOBAL, but this will be significantly _slower_ than using the simple bit test. It takes something over a dozen instructions to load a jump address from an array, and then jump to it....

Best Wishes
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Wed Nov 28, 2012 10:00 am     Reply with quote

Thank you!
_________________
CCS PCM 5.078 & CCS PCH 5.093
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