📄 counterform.frm
字号:
VERSION 5.00
Begin VB.Form frmCntSrc
BorderStyle = 3 'Fixed Dialog
Caption = "Counter"
ClientHeight = 6120
ClientLeft = 45
ClientTop = 330
ClientWidth = 6225
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6120
ScaleWidth = 6225
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text1
BackColor = &H8000000B&
BorderStyle = 0 'None
Enabled = 0 'False
Height = 1095
Left = 3360
MultiLine = -1 'True
TabIndex = 34
Text = "CounterForm.frx":0000
Top = 4560
Width = 2415
End
Begin VB.Timer EventTimer
Enabled = 0 'False
Interval = 1
Left = 3480
Top = 2760
End
Begin VB.Timer ReadCntTimer
Enabled = 0 'False
Interval = 1000
Left = 3600
Top = 2040
End
Begin VB.Frame frmTcInt
Caption = "TC Interrupt Enable"
Height = 615
Left = 3840
TabIndex = 15
Top = 3000
Width = 2055
Begin VB.OptionButton opIntDisable
Caption = "Disable"
Height = 255
Left = 1080
TabIndex = 33
Top = 240
Value = -1 'True
Width = 855
End
Begin VB.OptionButton opIntEnable
Caption = "Enable"
Height = 195
Left = 120
TabIndex = 32
Top = 240
Width = 855
End
End
Begin VB.Frame frmOutput
Caption = "Output Mode"
Height = 615
Left = 2040
TabIndex = 14
Top = 3840
Width = 3855
Begin VB.ComboBox cmbOPMode
Height = 315
ItemData = "CounterForm.frx":0093
Left = 120
List = "CounterForm.frx":00A3
TabIndex = 21
Top = 240
Width = 3135
End
End
Begin VB.CommandButton cmdStop
Caption = "Stop"
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 13
Top = 5400
Width = 1095
End
Begin VB.CommandButton cmdStart
Caption = "Start"
Height = 375
Left = 240
TabIndex = 12
Top = 5400
Width = 975
End
Begin VB.Frame frmGateMode
Caption = "Gate Mode"
Height = 2055
Left = 3960
TabIndex = 10
Top = 840
Width = 1935
Begin VB.Frame frmGatePl
Caption = "Gate Polarity"
Height = 855
Left = 240
TabIndex = 17
Top = 1080
Width = 1455
Begin VB.OptionButton OpLoLv
Caption = "Low Level"
Height = 255
Left = 120
TabIndex = 31
Top = 480
Width = 1095
End
Begin VB.OptionButton opHiLv
Caption = "High Level"
Height = 255
Left = 120
TabIndex = 30
Top = 240
Value = -1 'True
Width = 1215
End
End
Begin VB.Frame frmGateSrc
Caption = "Gate Source"
Height = 735
Left = 240
TabIndex = 16
Top = 240
Width = 1455
Begin VB.ComboBox cmbGateSrc
Height = 315
ItemData = "CounterForm.frx":00F7
Left = 120
List = "CounterForm.frx":0104
Style = 2 'Dropdown List
TabIndex = 22
Top = 240
Width = 1095
End
End
End
Begin VB.Frame frmIniVal
Caption = "Initial Value"
Height = 735
Left = 120
TabIndex = 9
Top = 3720
Width = 1455
Begin VB.TextBox txtIniVal
Height = 375
Left = 120
TabIndex = 23
Text = "1"
Top = 240
Width = 1095
End
End
Begin VB.Frame frmOPCtrl
Caption = "Output Control"
Height = 735
Left = 2040
TabIndex = 8
Top = 2760
Width = 1455
Begin VB.OptionButton opDisable
Caption = "Disable"
Height = 195
Left = 240
TabIndex = 29
Top = 480
Width = 1095
End
Begin VB.OptionButton opEnable
Caption = "Enable"
Height = 195
Left = 240
TabIndex = 28
Top = 240
Value = -1 'True
Width = 855
End
End
Begin VB.Frame frmCntDir
Caption = "Cnt Direction"
Height = 735
Left = 2040
TabIndex = 7
Top = 1800
Width = 1455
Begin VB.OptionButton opDown
Caption = "Down"
Height = 195
Left = 240
TabIndex = 27
Top = 480
Width = 975
End
Begin VB.OptionButton opUp
Caption = "Up"
Height = 195
Left = 240
TabIndex = 26
Top = 240
Value = -1 'True
Width = 1095
End
End
Begin VB.Frame frmCntEdge
Caption = "Count Edge"
Height = 735
Left = 2040
TabIndex = 6
Top = 840
Width = 1455
Begin VB.OptionButton opFalling
Caption = "Falling"
Height = 195
Left = 240
TabIndex = 25
Top = 480
Width = 855
End
Begin VB.OptionButton opRising
Caption = "Rising"
Height = 195
Left = 240
TabIndex = 24
Top = 240
Value = -1 'True
Width = 975
End
End
Begin VB.Frame frmCntSrc
Caption = "Count Source"
Height = 735
Left = 120
TabIndex = 5
Top = 2760
Width = 1455
Begin VB.ComboBox cmbCntSrc
Height = 315
ItemData = "CounterForm.frx":0123
Left = 120
List = "CounterForm.frx":013F
Style = 2 'Dropdown List
TabIndex = 20
Top = 240
Width = 1095
End
End
Begin VB.Frame frmCntMode
Caption = "CntMode"
ClipControls = 0 'False
Height = 735
Left = 120
TabIndex = 4
Top = 1800
Width = 1455
Begin VB.ComboBox cmbCntMode
Height = 315
ItemData = "CounterForm.frx":0182
Left = 120
List = "CounterForm.frx":01B6
Style = 2 'Dropdown List
TabIndex = 19
Top = 240
Width = 1095
End
End
Begin VB.Frame frmChannel
Caption = "Channel"
Height = 735
Left = 120
TabIndex = 3
Top = 840
Width = 1455
Begin VB.ComboBox cmbChannel
Height = 315
ItemData = "CounterForm.frx":01EA
Left = 120
List = "CounterForm.frx":0206
Style = 2 'Dropdown List
TabIndex = 18
Top = 240
Width = 1095
End
End
Begin VB.Frame frmDevSelection
Caption = "Selected Device"
Height = 735
Left = 120
TabIndex = 0
Top = 0
Width = 5775
Begin VB.CommandButton cmdDevSelect
Caption = "Device Selcetion"
Height = 375
Left = 4080
TabIndex = 1
Top = 240
Width = 1575
End
Begin VB.Label labDevName
Height = 375
Left = 120
TabIndex = 2
Top = 240
Width = 3855
End
End
Begin VB.Label labResult
Alignment = 2 'Center
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 11
Top = 4560
Width = 3015
End
End
Attribute VB_Name = "frmCntSrc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ptDevFeatures As DEVFEATURES ' structure for device features
Dim ptDevGetFeatures As PT_DeviceGetFeatures
Dim DeviceNum As Long
Dim DriverHandle As Long
Dim ErrorNum As Long
Dim lBoardID As Long
Dim usMaxCntNum As Integer
Dim bRun As Boolean
Dim bGateEnable As Boolean
Dim usChannel As Integer ' input port
Dim usMode As Integer ' counter mode
Dim usCountSrc As Integer ' count source
Dim usInitValue As Integer ' initial value
Dim usOutputMode As Integer ' output mode
Dim usCntEdge As Integer ' count edge
Dim usCntDir As Integer ' count direction
Dim usOutputEnable As Integer ' output enable
Dim usGateSrc As Integer ' gate source
Dim usGatePl As Integer ' gate polarity
Dim ptEnableEvent As PT_EnableEvent
Dim ptCounterConfig As PT_CounterConfig
Dim ptCounterEventStart As PT_CounterEventStart
Private Sub cmbCntMode_Click()
If (cmbCntMode.ListIndex <> 0) And (cmbCntMode.ListIndex <> 3) And (cmbCntMode.ListIndex <> 6) And (cmbCntMode.ListIndex <> 9) Then
frmGateMode.Enabled = True
Else
frmGateMode.Enabled = False
End If
End Sub
Private Sub cmdDevSelect_Click()
Call Form_Load
End Sub
Private Sub cmdStart_Click()
ErrorNum = DRV_DeviceOpen(DeviceNum, DriverHandle)
If CheckError(ErrorNum) <> 0 Then
Exit Sub
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -