'-------------------------------------------------------------- ' (c) 1997,1998 MCS Electronics '-------------------------------------------------------------- ' file: INT0.BAS ' demo: ON INT0 .. , RETURN, PRIORITY '-------------------------------------------------------------- Dim Count As Byte , Ts As Byte On Int0 Int0_int 'Initialise the INT0 Interrupt Rem On Int0 Int0_int Nosave 'Initialise the INT0 Interrupt Rem Use The Nosave Option When You Dont Want The Internal Registers To Be Saved/restored In Rem The Interrupt Routine Enable Interrupts Enable Int0 'enable the interrupt Priority Set Int0 'set INT0 to the highest priority level (INT0 has by default the highest prio) '!!! dont use COUNTER0/1 as a variable because it is a reserved word !!! Count = 0 'reset counter Do Ts = Inkey 'get key from serial device Loop Until Ts = 27 'loop until users presses ESC key End Rem The Interrupt Handler For The Int0 Interrupt Int0_int: Inc Count If Count = 2 Then Print "Int 0 occured" Count = 0 End If Rem You Can Perform More Actions Here Return 'notice the return