📄 3x3keypad.bas
字号:
Config Lcd = 16 * 2
P3 = 255
Dim Bt As Byte
Dim Count As Integer
Dim Count1 As Integer
Dim A1 As Integer
Bt = 0
Count = 0
Count1 = 0
Aa:
A1 = P2
Gosub Keyscan
Gosub Obser
Select Case Bt
Case 1:
P2 = 01
Case 2:
P2 = 02
Case 3:
P2 = 03
Case 4:
P2 = 04
Case 5:
P2 = 05
Case 6:
P2 = 06
Case 7:
P2 = 07
Case 8:
P2 = 08
Case 9:
P2 = 09
Case 10:
P2 = 10
Case 11:
P2 = 11
Case 12:
P2 = 12
Case 13:
P2 = 13
Case 14:
P2 = 14
Case 15:
P2 = 15
Case 16:
P2 = 10
Case Else
P2 = 00
End Select
'End
A1 = P2
Cls
Lcd A1
Goto Aa
'////////////////////////////////
Keyscan:
P3.3 = 0
P3.4 = 0
P3.5 = 0
If Bt <> 1 Then
Count = 0
Count1 = 0
Bt = 1
End If
P3.3 = 1
P3.4 = 0
P3.5 = 0
If Bt <> 2 Then
Count = 0
Count1 = 0
Bt = 2
End If
P3.3 = 0
P3.4 = 1
P3.5 = 0
If Bt <> 3 Then
Count = 0
Count1 = 0
Bt = 3
End If
P3.3 = 1
P3.4 = 1
P3.5 = 0
If Bt <> 4 Then
Count = 0
Count1 = 0
Bt = 4
End If
P3.3 = 0
P3.4 = 0
P3.5 = 1
If Bt <> 5 Then
Count = 0
Count1 = 0
Bt = 5
End If
P3.3 = 1
P3.4 = 0
P3.5 = 1
If Bt <> 6 Then
Count = 0
Count1 = 0
Bt = 6
End If
P3.3 = 0
P3.4 = 1
P3.5 = 1
If Bt <> 7 Then
Count = 0
Count1 = 0
Bt = 7
End If
P3.3 = 1
P3.4 = 1
P3.5 = 1
If Bt <> 8 Then
Count = 0
Count1 = 0
Bt = 8
End If
P3.3 = 0
P3.4 = 0
P3.5 = 0
If Bt <> 9 Then
Count = 0
Count1 = 0
Bt = 9
End If
P3.3 = 1
P3.4 = 0
P3.5 = 0
If Bt <> 10 Then
Count = 0
Count1 = 0
Bt = 10
End If
P3.3 = 0
P3.4 = 1
P3.5 = 0
If Bt <> 11 Then
Count = 0
Count1 = 0
Bt = 11
End If
P3.3 = 1
P3.4 = 1
P3.5 = 0
If Bt <> 12 Then
Count = 0
Count1 = 0
Bt = 12
End If
P3.3 = 0
P3.4 = 0
P3.5 = 1
If Bt <> 13 Then
Count = 0
Count1 = 0
Bt = 13
End If
P3.3 = 1
P3.4 = 0
P3.5 = 1
If Bt <> 14 Then
Count = 0
Count1 = 0
Bt = 14
End If
P3.3 = 0
P3.4 = 1
P3.5 = 1
If Bt <> 15 Then
Count = 0
Count1 = 0
Bt = 15
End If
P3.3 = 1
P3.4 = 1
P3.5 = 1
If Bt <> 16 Then
Count = 0
Count1 = 0
Bt = 16
End If
Return
Obser:
If Bt > 0 Then
Incr Count
If Count >= 800 Then
Incr Count1
If Count1 >= 800 Then
Count = 0
Count1 = 0
Bt = 0
End If
End If
End If
Return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -