InvaderZim
Senior Member
Hi all, I'm familiar with basic interrupt operation. Here's my situation:
I've got subroutines that are called both in the main code and also in the interrupt code. Things are complicated enough that I decided to have a policy of preventing the subroutines from being interrupted. That prevents a subroutine from being part-way through, getting interrupted, and then being called again, which can lead to variables being corrupted upon return from the interrupt.
To keep things tidy, I turn off interrupts at the start of a subroutine, and then turn them on again at the end of a subroutine. I was worried about enabling the interrupt within the interrupt subroutine; I usually only do this at the very end of the interrupt sub. However, the manual says that interrupts will stay disabled until the interrupt sub returns, even if you turn them on at the beginning of the sub. Great! Everything sounds perfect...on paper.
In reality it seems that re-enabling the interrupts within the subroutines will not cause the interrupt sub to be called recursively, however any pauses in the interrupt sub will be prematurely terminated by interrupt conditions (as if interrupted).
Any advice? Clear as mud? I could post code but I figured that would just confuse things. Thanks in advance!
I've got subroutines that are called both in the main code and also in the interrupt code. Things are complicated enough that I decided to have a policy of preventing the subroutines from being interrupted. That prevents a subroutine from being part-way through, getting interrupted, and then being called again, which can lead to variables being corrupted upon return from the interrupt.
To keep things tidy, I turn off interrupts at the start of a subroutine, and then turn them on again at the end of a subroutine. I was worried about enabling the interrupt within the interrupt subroutine; I usually only do this at the very end of the interrupt sub. However, the manual says that interrupts will stay disabled until the interrupt sub returns, even if you turn them on at the beginning of the sub. Great! Everything sounds perfect...on paper.
In reality it seems that re-enabling the interrupts within the subroutines will not cause the interrupt sub to be called recursively, however any pauses in the interrupt sub will be prematurely terminated by interrupt conditions (as if interrupted).
Any advice? Clear as mud? I could post code but I figured that would just confuse things. Thanks in advance!