📄 frmcounter.frm
字号:
Height = 195
Left = 345
TabIndex = 46
Top = 1425
Width = 1230
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "Counter Enable :"
Height = 195
Left = 300
TabIndex = 37
Top = 555
Width = 1275
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "Bit :"
Height = 195
Left = 1080
TabIndex = 36
Top = 240
Width = 495
End
Begin VB.Label Label1
Caption = "7"
Height = 255
Index = 7
Left = 1770
TabIndex = 35
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "6"
Height = 255
Index = 6
Left = 2355
TabIndex = 34
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "5"
Height = 255
Index = 5
Left = 2955
TabIndex = 33
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "4"
Height = 255
Index = 4
Left = 3540
TabIndex = 32
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "3"
Height = 255
Index = 3
Left = 4140
TabIndex = 31
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "2"
Height = 255
Index = 2
Left = 4725
TabIndex = 30
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "1"
Height = 255
Index = 1
Left = 5310
TabIndex = 29
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "0"
Height = 255
Index = 0
Left = 5910
TabIndex = 28
Top = 240
Width = 255
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "Preset Value :"
Height = 195
Left = 405
TabIndex = 27
Top = 960
Width = 1170
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "Match Value :"
Height = 195
Left = 360
TabIndex = 26
Top = 1800
Width = 1215
End
End
Attribute VB_Name = "frmCounter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public EnableMask As Integer
Public Direction As Integer
Public TrigEdge As Integer
Public MatchEnableMask As Integer
Public OverflowEnableMask As Integer
Public bCancel As Boolean
Private Sub chkBitEnable_Click(Index As Integer)
If chkBitEnable(Index).value = 1 Then
txtPresetValue(Index).Enabled = True
chkMatchEnable(Index).Enabled = True
chkOverflow(Index).Enabled = True
framBit(Index).Enabled = True
optRising(Index).Enabled = True
optFalling(Index).Enabled = True
Call chkMatchEnable_Click(Index)
Select Case Index
Case 0
EnableMask = EnableMask Or &H1
Case 1
EnableMask = EnableMask Or &H2
Case 2
EnableMask = EnableMask Or &H4
Case 3
EnableMask = EnableMask Or &H8
Case 4
EnableMask = EnableMask Or &H10
Case 5
EnableMask = EnableMask Or &H20
Case 6
EnableMask = EnableMask Or &H40
Case 7
EnableMask = EnableMask Or &H80
End Select
Else
txtPresetValue(Index).Enabled = False
chkMatchEnable(Index).Enabled = False
chkOverflow(Index).Enabled = False
framBit(Index).Enabled = False
optRising(Index).Enabled = False
optFalling(Index).Enabled = False
txtMatchValue(Index).Enabled = False
Select Case Index
Case 0
EnableMask = EnableMask And &HFE
Case 1
EnableMask = EnableMask And &HFD
Case 2
EnableMask = EnableMask And &HFB
Case 3
EnableMask = EnableMask And &HF7
Case 4
EnableMask = EnableMask And &HEF
Case 5
EnableMask = EnableMask And &HDF
Case 6
EnableMask = EnableMask And &HBF
Case 7
EnableMask = EnableMask And &H7F
End Select
End If
End Sub
Private Sub chkMatchEnable_Click(Index As Integer)
If chkMatchEnable(Index).value = 1 Then
txtMatchValue(Index).Enabled = True
Select Case Index
Case 0
MatchEnableMask = MatchEnableMask Or &H1
Case 1
MatchEnableMask = MatchEnableMask Or &H2
Case 2
MatchEnableMask = MatchEnableMask Or &H4
Case 3
MatchEnableMask = MatchEnableMask Or &H8
Case 4
MatchEnableMask = MatchEnableMask Or &H10
Case 5
MatchEnableMask = MatchEnableMask Or &H20
Case 6
MatchEnableMask = MatchEnableMask Or &H40
Case 7
MatchEnableMask = MatchEnableMask Or &H80
End Select
Else
txtMatchValue(Index).Enabled = False
Select Case Index
Case 0
MatchEnableMask = MatchEnableMask And &HFE
Case 1
MatchEnableMask = MatchEnableMask And &HFD
Case 2
MatchEnableMask = MatchEnableMask And &HFB
Case 3
MatchEnableMask = MatchEnableMask And &HF7
Case 4
MatchEnableMask = MatchEnableMask And &HEF
Case 5
MatchEnableMask = MatchEnableMask And &HDF
Case 6
MatchEnableMask = MatchEnableMask And &HBF
Case 7
MatchEnableMask = MatchEnableMask And &H7F
End Select
End If
End Sub
Private Sub chkOverflow_Click(Index As Integer)
If chkOverflow(Index).value = 1 Then
Select Case Index
Case 0
OverflowEnableMask = OverflowEnableMask Or &H1
Case 1
OverflowEnableMask = OverflowEnableMask Or &H2
Case 2
OverflowEnableMask = OverflowEnableMask Or &H4
Case 3
OverflowEnableMask = OverflowEnableMask Or &H8
Case 4
OverflowEnableMask = OverflowEnableMask Or &H10
Case 5
OverflowEnableMask = OverflowEnableMask Or &H20
Case 6
OverflowEnableMask = OverflowEnableMask Or &H40
Case 7
OverflowEnableMask = OverflowEnableMask Or &H80
End Select
Else
Select Case Index
Case 0
OverflowEnableMask = OverflowEnableMask And &HFE
Case 1
OverflowEnableMask = OverflowEnableMask And &HFD
Case 2
OverflowEnableMask = OverflowEnableMask And &HFB
Case 3
OverflowEnableMask = OverflowEnableMask And &HF7
Case 4
OverflowEnableMask = OverflowEnableMask And &HEF
Case 5
OverflowEnableMask = OverflowEnableMask And &HDF
Case 6
OverflowEnableMask = OverflowEnableMask And &HBF
Case 7
OverflowEnableMask = OverflowEnableMask And &H7F
End Select
End If
End Sub
Private Sub cmdCancel_Click()
bCancel = True
Me.Hide
End Sub
Private Sub cmdPatternOK_Click()
bCancel = False
Me.Hide
End Sub
Private Sub Form_Load()
EnableMask = 0
Direction = 0 ' Up count
TrigEdge = &HFF ' All Rising edge trigger
End Sub
Private Sub optFalling_Click(Index As Integer)
If optFalling(Index).value = True Then
Select Case Index
Case 0
TrigEdge = TrigEdge And &HFE
Case 1
TrigEdge = TrigEdge And &HFD
Case 2
TrigEdge = TrigEdge And &HFB
Case 3
TrigEdge = TrigEdge And &HF7
Case 4
TrigEdge = TrigEdge And &HEF
Case 5
TrigEdge = TrigEdge And &HDF
Case 6
TrigEdge = TrigEdge And &HBF
Case 7
TrigEdge = TrigEdge And &H7F
End Select
End If
End Sub
Private Sub optRising_Click(Index As Integer)
If optRising(Index).value = True Then
Select Case Index
Case 0
TrigEdge = TrigEdge Or &H1
Case 1
TrigEdge = TrigEdge Or &H2
Case 2
TrigEdge = TrigEdge Or &H4
Case 3
TrigEdge = TrigEdge Or &H8
Case 4
TrigEdge = TrigEdge Or &H10
Case 5
TrigEdge = TrigEdge Or &H20
Case 6
TrigEdge = TrigEdge Or &H40
Case 7
TrigEdge = TrigEdge Or &H80
End Select
End If
End Sub
Private Sub optUpCount_Click()
If optUpCount.value = Checked Then
Direction = 0
End If
End Sub
Private Sub optDownCount_Click()
If optDownCount.value = Checked Then
Direction = 1
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -