8051- Returning from an interrupt to a fixed location

Hi everyone,
Is there a way to return to a fixed location from an interrupt?

In my program I have something like this:

void main(void)
{
        ...//some instructions

        while(1)
        {
                ...//some instructions

                EX1=1;    //enable external interrupt 1
                my_function();
                EX1=0;   //disable external interrupt 1
        }

}

As you can see, an external interrupt 1 can occur somewhere in the middle of my_function (or in the middle of other functions that my_function calls).
And I want that when we go back from the external interrupt 1 subroutine, the processor will go right to the beginning of while(1) and SKIP the rest of my_function (instead of returning to where it was called from).

Is there a way to do this?
(And by the way, I don't care about all the local variables of any of the functions or the main. They are all irrelevant if EX1 occurs, so there's no need to save them before "returning" to that location).

I'd really appreciate your help!!

Parents
  • Oh well, If you're so strongly against it, then I'll use a flag as you suggested...

    The reason why I wanted it was that I wanted my program to react FAST to a change of one of the inputs (that I connected to EX1), so I thought I'd save the time it takes to check the condition of the flag and return from all the functions, and instead initiate my "return" right to where I need it. It would have saved me some precious microseconds that are needed for my application.

    But if you all think that that's a bad idea then I'll drop it.
    Thanks!

Reply
  • Oh well, If you're so strongly against it, then I'll use a flag as you suggested...

    The reason why I wanted it was that I wanted my program to react FAST to a change of one of the inputs (that I connected to EX1), so I thought I'd save the time it takes to check the condition of the flag and return from all the functions, and instead initiate my "return" right to where I need it. It would have saved me some precious microseconds that are needed for my application.

    But if you all think that that's a bad idea then I'll drop it.
    Thanks!

Children
More questions in this forum