|
|
View previous topic :: View next topic |
Author |
Message |
asjad
Joined: 09 Mar 2004 Posts: 52 Location: Greater Manchester - UK
|
manually setting interrupts |
Posted: Tue Mar 30, 2004 6:48 am |
|
|
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 |
Posted: Tue Mar 30, 2004 7:41 am |
|
|
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 |
|
|
|
|
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
|