'{$STAMP BS2} '{$PBASIC 2.5} '{$PORT COM1} Flag1 VAR IN15 Flag2 VAR Bit Indicator VAR OUT8 isON CON 0 isOFF CON 1 Initialize: OUTPUT 8 INPUT 0 Flag2=0 '--------------------------------------- Interrupt: IF Flag1=1 THEN GOTO ExitInterrupt DEBUG "Running Interrupt",CR Indicator = isON IF Flag2=0 THEN Flag2=1 'One-Shot: Interrupt routines here 'Option to GOTO ExitInterrupt right now 'or wait until external input resets 'before going to ExitInterrupt. ENDIF 'Repeat: Interrupt routines here 'As long as the external input remains 'LOW this code section will run in an 'endless loop unless the "One-Shot" 'Interrupt mode immediately exits to 'the ExitInterrupt. GOTO Interrupt ExitInterrupt: Indicator = isOFF '--------------------------------------- MainProgram: DEBUG "Running MainProgram",CR 'Do your normal code stuff here... GOTO MainProgram