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

Can I have the same ISR for Timer3 & INT0?

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



Joined: 23 Oct 2008
Posts: 29

View user's profile Send private message

Can I have the same ISR for Timer3 & INT0?
PostPosted: Thu Dec 18, 2008 10:31 am     Reply with quote

Hi. How can I make the pc to jump to one ISR for #INT_TIMER3 & #INT_EXT. Can I do that? Can I have the same ISR for Timer3 & INT0?

Regards
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Thu Dec 18, 2008 10:47 am     Reply with quote

I don't believe you can have them go to the same ISR, but you could have the ISR's execute the same function, which would essentially be the same.
Granted, you probably wouldn't want to be printing from inside and ISR, but you get the point of what I mean?

Code:
#isr_1

{
Common_Function_1();
Common_Function_2();
}



#isr_2
{
Common_Function_1();
Common_Function_2();
}
...
...
...
void Common_Function_1()
{
printf("This is the 1st function common to ISR 1 and 2");
}


void Common_Function_2()
{
printf("This is the 2nd function common to ISR 1 and 2");
}



main()
{
while(1)

printf("not in an ISR right now!");
delay_ms(1000);

}

_________________
A HW Engineer 'trying' to do SW !!! Run!!!
MicroManiac



Joined: 21 Aug 2008
Posts: 34

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

PostPosted: Fri Dec 19, 2008 7:26 am     Reply with quote

you can use the pre-processor directive

Code:
#int_global
void isr()
{

}

this will route the all interrupts to this function
but be careful using the compiler does not create the start up code and end code, and so if not being cautious, your system might fail
check with CCS help before you use this function.
_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
Albert Einstein
baltazar_aquino



Joined: 16 Mar 2008
Posts: 27

View user's profile Send private message

PostPosted: Fri Dec 19, 2008 6:10 pm     Reply with quote

Generally,in PIC MCUs, ISRs are in fact under one "big handler" if you are in the assembly language level. It is the programmer's responsibility to decode which particular part of the MCU hardware triggered the interrupt and then there's the segregation. CCS C just happened to be a higher level language and gives the programmer an easier life by providing segregated ISRs. I have the same suggestion as MicroManiac's.
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