This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to jump to assigned place after interrupt occurs ?

Hi,

I want to implement following job in C code with Keil C51.
(1) jump to a place (function entry) after an interrupt occurs.

I know how to implement it in assemble, but I don't know how to implement it in C ?

Following is the implementation in assemble,

JUMP_HERE: CLR A
...
...

Int1: MOV DPTR,#JUMP_HERE
PUSH DPL
PUSH DPH
RETI

Does following C code works ?

void main()
{
while(1)
{
JUMP_HERE:
func1();
...
}
}

void
Int0_ISR (void) interrupt 0 using 1
{
// C code here
....
#pragma asm
MOV DPTR,#JUMP_HERE
PUSH DPL
PUSH DPH
#pragma endasm
}

I know you can only use the goto statement within same function in C.

Any idea ? Thanks.

Daniel

Parents Reply Children
  • "See his post of 4/11/06 1:58:24:
    "... my main loop is pseudo-multitasking ...""

    Quite.

  • it is a bit difficult to find replies that appear OVER the question.

    anyhow
    "... my main loop is pseudo-multitasking ...""

    If you have the capability to read from "my main loop is pseudo-multitasking" what exactly he means and based on that state "there would most definitely be 'not robust' things" please tell me where you got the glasses that enable you to read the information on which you base that statement. I have seen a simple workloop called "pseudo-multitasking" and I have seen many other schemes named so. The naming of something "pseudo-multitasking" is quite popular since "multitasking" makes anything sound more impressive. If you have just one ISR you can claim that you are "multitasking" and in one sense (not the common one) you would be right.

    The "unused ISR trick" is "priority multitasking" since the action in the "unused" ISR will have priority over the main. If you check on some multitasking OSs for some processors (e.g. the XA) that have several software interrupts, you will see it is done exactly this way.

    Erik

  • If you have the capability to read from "my main loop is pseudo-multitasking" what exactly he means and based on that state "there would most definitely be 'not robust' things" please tell me where you got the glasses that enable you to read the information on which you base that statement.

    Perhaps you'd like to explain where you got the idea I based my statement on his main loop being pseudo multitasking?

    I have seen a simple workloop called "pseudo-multitasking" and I have seen many other schemes named so. The naming of something "pseudo-multitasking" is quite popular since "multitasking" makes anything sound more impressive. If you have just one ISR you can claim that you are "multitasking" and in one sense (not the common one) you would be right.

    Do you understand what 'pseudo' means? Do you really think it tells us there is a 'task switcher' involved? Not from your paragraph above, it would seem.