That's a good question...
I wonder if something like this would work?
Like Henrick said, the routines could be cut short anytime the button is pushed though.Code:x VAR BIT ;----------------------- Setup Interrupts -------------------------------- INCLUDE "DT_INTS-18.bas" ; Darrel Taylor's Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler INT0_INT, Button_ISR, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM ;----------------------[Initialise Interrupts]----------------------- @ INT_ENABLE INT0_INT ; Enable Button interrupt input x = 0 ' Clear button status flag bit PAUSE 100 GOTO loop1 ' Start at loop1 routine ' ---------------- Independent program routines ------------------------- loop1_start: @ INT_RETURN ; Reset the ISR loop1: ' Perform one type of "time critical" function GOTO loop1 loop2_start: @ INT_RETURN ; Reset the ISR loop2: ' Perform a different type of "time critical" function GOTO loop2 ;--------------------[Program routine selector ISR]---------------------- ; make sure button signal debounced Button_ISR: x = !x ' Toggle x status flag bit IF !x THEN GOTO loop1_start ' Go here when x=0 ELSE GOTO loop2-start ' Go here when x=1 @ INT_RETURN




Bookmarks