Sorry for the delay, but I don’t think that would be a good solution since the ISR should only spend enough time in there to update values, take readings, turn things ON/OFF, etc.. Pretty much just get in and get out.
Your example is like the one Henrik suggested but within the ISR.
But got another wild idea if your tight loop can sacrifice just a little time to test the ISR flag bit:
Code:
INT VAR BIT
INT = 0
'------------------------
loop1:
code
IF INT THEN GOTO loop2 ' Jump to loop2 after loop1 finished if interrupt triggered
GOTO loop1
loop2:
more code
IF !INT THEN GOTO loop1 ' Jump to loop1 after loop2 finished if interrupt triggered
GOTO loop2
; -------------- ISR toggles a flag bit ----------
Button_ISR:
INT = !INT
@ INT_RETURN
This way, I'm thinking, any one of the loops can complete it's mission before jumping to the other routine should an interrupt happen. Or just continue in it's loop until the button is pushed.
Bookmarks