PhilHornby
Senior Member
I have some Picaxe 20X2 code that I'm in the process of tidying - it has been running 'correctly' for the past year or so...
It uses interrupts for Hint1,Hint2,Timer Overflow and Serial Background Receive.
My question is: how are overlapping interrupts best handled?
For example - say the 'Interrupt' service routine is called for Hint1 and some time later, while it is still processing, the timer overflows as well. Presumably, with 'toflag' now being set, the ISR will be re-invoked, once the 'SetIntFlags' and 'return' statements are executed.
It struck me, that I could loop back to my 'Interrupt' routine's despatcher and deal with any new interrupts, before issuing 'SetIntFlags' and leaving.
I've not seen anyone else adopt this technique(!), so are there any dis-advantages to it? (Presumably it is slightly more efficient in terms of execution speed...)
It uses interrupts for Hint1,Hint2,Timer Overflow and Serial Background Receive.
My question is: how are overlapping interrupts best handled?
For example - say the 'Interrupt' service routine is called for Hint1 and some time later, while it is still processing, the timer overflows as well. Presumably, with 'toflag' now being set, the ISR will be re-invoked, once the 'SetIntFlags' and 'return' statements are executed.
It struck me, that I could loop back to my 'Interrupt' routine's despatcher and deal with any new interrupts, before issuing 'SetIntFlags' and leaving.
I've not seen anyone else adopt this technique(!), so are there any dis-advantages to it? (Presumably it is slightly more efficient in terms of execution speed...)