#10471 - sgeos - Sat Sep 06, 2003 12:26 am
Is this a safe way to set up an interrupt routine?
void foo(void)
{
/* Do stuff */
}
*(void **)0x03007FFC = (void *)&foo;
*(u16 *)0x04000200 = VALUE;
/* Set any other misc interrupt flags */
*(u16 *)0x04000208 = 0x0001;
-Brendan Sechter
#10473 - tepples - Sat Sep 06, 2003 1:38 am
Looks safe so far, depending on what you're doing in foo().
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#10475 - sgeos - Sat Sep 06, 2003 2:03 am
Is it safe to call other functions from within an interrupt routine as set up above?
Code: |
void baz(void)
{
/* Do stuff */
}
void bar(void)
{
/* Do stuff */
}
void foobar(void)
{
/* Do stuff */
bar();
baz();
}
void foo(void)
{
/* Do stuff */
foobar();
} |
-Brendan Sechter
#10478 - tepples - Sat Sep 06, 2003 2:58 am
Function calls from interrupts do work for me, but in general, don't try complicated functions in interrupt time. ISRs have to get in, do their jobs, and get out quickly.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#10508 - sgeos - Sat Sep 06, 2003 7:42 pm
Assuming that REG_IF is cleared after every interrupt, will REG_IF ever have more than one bit set at a time?
-Brendan Sechter
#10511 - Lupin - Sat Sep 06, 2003 8:19 pm
yes, if 2 interrupts occour at the same time