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

Jumping back to main program inside ISR

Hi all,

I have a C51 application that requires the following operation which is close to a reset but it is not a reset:

1. when a bit is set in a register, call a function and return
2. when a bit is cleared in a register, exit the ISR and jump back to the main routine (the stack should be reset).

I use Keil C51 and uses the following method trying to achieve the aims but to no avail:

void isr(void) interrupt
{ if (register & bit) function1(); else
#pragma asm ljmp 800H; // 800h=main routine address
#pragma endasm
}

I tried this routine but it seems that the code is stuck. Has anybody tried a similar implementation, or is there anything that I can do to implement such a scheme?

Thanks very much for your response and Best Regards.

William