Jump to content

jump to main() inside ISR


xolang1

Recommended Posts

In codevision 1.23, how does one jump from the interrupt subroutine to main()? I'd like to a code that will uses a timer to time 2 seconds after a certain event in main() occurs. when s secs is seen in the interrupt subroutine, it executes some code lines then if should go back to a certain line in the main code other than the point where the interrupt routine goes...

 

I was thinking of a forced jump instruction... any ideas?

Link to comment
Share on other sites

Hello xolang1

 

I do not know why you would want to jump to main inside an interrupt routine. If you try, you will still be in the interrupt routine until you get to the exit code. You could create all sorts of problems if you were abloe to stack up interrupts.

If you wish to force the exit from interrupt to go to a particular address rather than returning to where the interrupt was called from, you can push the new return address onto the stack before the RETI. You should becareful not to push more than you pop, otherwise you will get a stack overflow.

I use this technique if I want to do a warm boot on an error such as a timeout error.

If you want to let the interrupt routine determine a main line function, you can set up a series of semaphores. In operation, the mainline code continually tests the semaphores, and the interrupt routines set the semaphores.

 

Perhaps you could give more detail of your requirements and someone may be able to be more specific in the reply.

 

Best regards,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...