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

Handling ISR

I have a general question regarding handling ISRs which stems from my inexperience. My understanding of ISR is that the execution branches, from the main code, to the ISR upon a condition being satisfied. After executing the ISR code it goes back to the main code, essentially back to the point where it paused to go to the ISR.
My question is can I call another function within the ISR instead of having the execution go back to where it had left off? Would it cause any adverse effects?
I am sure I must have confused some people by now for which i would like to apologize. Your criticisms/comments are welcome.

Parents
  • you can call functions from within an ISR, but that might require extra stack space - the C166 is very different from that perspective than an ARM (which has dedicated stacks per processor mode). note that you can even "cheat" and change the right word in your processor stack to modify the return address of the ISR, so that you can manipulate the actual return location! that is how preemptive schedulers work. If you want to experiment, place a breakpoint at the entry to an ISR and have a look at your stack. Somewhere, you will see the address of the latest instruction that was executed before the interrupt!

Reply
  • you can call functions from within an ISR, but that might require extra stack space - the C166 is very different from that perspective than an ARM (which has dedicated stacks per processor mode). note that you can even "cheat" and change the right word in your processor stack to modify the return address of the ISR, so that you can manipulate the actual return location! that is how preemptive schedulers work. If you want to experiment, place a breakpoint at the entry to an ISR and have a look at your stack. Somewhere, you will see the address of the latest instruction that was executed before the interrupt!

Children