📄 int0.bas
字号:
'--------------------------------------------------------------
' (c) 1997-2000 MCS Electronics
'--------------------------------------------------------------
' file: INT0.BAS
' demo: ON INT0 .. , RETURN, PRIORITY
'--------------------------------------------------------------
Dim V1 As Integer
Dim Count As Integer , 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
V1 = V1 + 1
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:
Incr Count
If Count = 2 Then
Print "Int 0 occured"
Count = 0
End If
Rem You Can Perform More Actions Here
Return 'notice the return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -