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

manually setting interrupts

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



Joined: 09 Mar 2004
Posts: 52
Location: Greater Manchester - UK

View user's profile Send private message

manually setting interrupts
PostPosted: Tue Mar 30, 2004 6:48 am     Reply with quote

Hi folks,

I know that if you use standard ccS code you use

#int_rtcc
void tmr0interrupt ()
{

}

BUT, if I want do the following manually: (via INTCON reg)

A) turn on the interrupts
B) test interrupt flag

HOW/WHICH FUNCTION WILL BE ASSOCIATED WITH THE TMR0 INTERRUPT?

Any ides??
_________________
Best Regards
Ttelmah
Guest







Re: manually setting interrupts
PostPosted: Tue Mar 30, 2004 7:41 am     Reply with quote

asjad wrote:
Hi folks,

I know that if you use standard ccS code you use

#int_rtcc
void tmr0interrupt ()
{

}

BUT, if I want do the following manually: (via INTCON reg)

A) turn on the interrupts
B) test interrupt flag

HOW/WHICH FUNCTION WILL BE ASSOCIATED WITH THE TMR0 INTERRUPT?

Any ides??


With what you describe so far, the code will still automatically vector to tmr0interrupt, as soon as the flag becomes true, and when it returns, the flag will be cleared. Hence if you are testing the interrupt flag in the main code, it'll never be seen as true. However I think what you need to look at is the example covering the use of the '#int_global' function. This function, replaces the default interrupt parser, and will be called when _any_ interrupt that is enabled occurs. In this, you can then test the interrupt flags yourself. The caveat with this, is that this function also then has to handle all the saving/restoring of registers needed by the interrupt handler.

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