?? frmfreqtester.frm
字號:
VERSION 5.00
Object = "{4E2051E6-9099-11D2-A9D2-002018650913}#1.1#0"; "Adcounter.ocx"
Begin VB.Form frmFreqTester
Caption = "Freq Tester"
ClientHeight = 3900
ClientLeft = 45
ClientTop = 270
ClientWidth = 7065
LinkTopic = "Form1"
ScaleHeight = 3900
ScaleWidth = 7065
StartUpPosition = 2 'CenterScreen
Begin DAQCounterLib.DAQCounter DAQCounter1
Height = 495
Left = 5760
TabIndex = 24
Top = 240
Width = 495
_Version = 65537
_ExtentX = 864
_ExtentY = 864
_StockProps = 0
ErrorCode = 10002
ErrorMessage = "The OpenDevice method must be called before performing any I/O operations."
WatchdogTime = 0
WatchdogEnabled = 0 'False
End
Begin VB.CommandButton cmdExit
Caption = "Close"
Height = 372
Left = 5400
TabIndex = 17
Top = 960
Width = 1452
End
Begin VB.Frame Frame1
Caption = "Select Device :"
Height = 1212
Left = 120
TabIndex = 3
Top = 120
Width = 5055
Begin VB.TextBox txtDeviceNum
Height = 285
Left = 1320
TabIndex = 6
Text = "-100"
ToolTipText = "Device Number"
Top = 360
Width = 855
End
Begin VB.TextBox txtDeviceName
Height = 285
Left = 1320
TabIndex = 5
Text = "AdvanTech"
ToolTipText = "Device Name"
Top = 720
Width = 3495
End
Begin VB.CommandButton cmdSelectDevice
Caption = "&Select Device"
Default = -1 'True
Height = 375
Left = 3360
TabIndex = 4
ToolTipText = "Selecting device to operation"
Top = 240
Width = 1455
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Device No. :"
Height = 195
Left = 120
TabIndex = 8
Top = 405
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Device Name :"
Height = 195
Left = 120
TabIndex = 7
Top = 765
Width = 1065
End
End
Begin VB.Frame Frame2
Caption = "Property Settings:"
Height = 2295
Left = 120
TabIndex = 0
Top = 1440
Width = 3612
Begin VB.TextBox txtGatePeriod
Height = 285
Left = 1080
TabIndex = 14
Top = 1290
Width = 855
End
Begin VB.ComboBox cmbGateMode
Height = 288
ItemData = "frmFreqTester.frx":0000
Left = 1080
List = "frmFreqTester.frx":0013
TabIndex = 13
Top = 840
Width = 1095
End
Begin VB.ComboBox cmbChannel
Height = 288
ItemData = "frmFreqTester.frx":0054
Left = 1080
List = "frmFreqTester.frx":005B
TabIndex = 12
Top = 360
Width = 1095
End
Begin VB.TextBox txtScanTime
Height = 288
Left = 1080
TabIndex = 1
Text = "1000"
Top = 1800
Width = 855
End
Begin VB.Label Label10
Caption = "(only if PCL830)"
Height = 255
Left = 2280
TabIndex = 23
Top = 840
Width = 1215
End
Begin VB.Label Label9
Caption = "ms(only if PCL830)"
Height = 255
Left = 2040
TabIndex = 16
Top = 1320
Width = 1455
End
Begin VB.Label Label8
Caption = "ms "
Height = 255
Left = 2040
TabIndex = 15
Top = 1800
Width = 255
End
Begin VB.Label Label7
Caption = "Gate Period :"
Height = 252
Left = 120
TabIndex = 11
Top = 1320
Width = 972
End
Begin VB.Label Label6
Caption = "Gate Mode :"
Height = 252
Left = 120
TabIndex = 10
Top = 840
Width = 972
End
Begin VB.Label Label4
Caption = "Channel :"
Height = 252
Left = 120
TabIndex = 9
Top = 360
Width = 852
End
Begin VB.Label Label5
Caption = "Scan Time: ms"
Height = 255
Left = 120
TabIndex = 2
Top = 1800
Width = 975
End
End
Begin VB.Frame Frame3
Caption = "Freq Read:"
Height = 2295
Left = 3960
TabIndex = 18
Top = 1440
Width = 2892
Begin VB.CommandButton cmdScanStop
Caption = "Scan Stop"
Height = 372
Left = 1680
TabIndex = 21
Top = 360
Width = 972
End
Begin VB.CommandButton cmdScanStart
Caption = "Scan Start"
Height = 372
Left = 240
TabIndex = 20
Top = 360
Width = 972
End
Begin VB.TextBox txtFreq
Height = 288
Index = 0
Left = 1680
TabIndex = 19
Text = "0"
Top = 1080
Width = 855
End
Begin VB.Timer ScanTimer
Interval = 1000
Left = 2160
Top = 1680
End
Begin VB.Label Label3
Caption = "Frequency value :"
Height = 252
Left = 240
TabIndex = 22
Top = 1080
Width = 1332
End
End
End
Attribute VB_Name = "frmFreqTester"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmbChannel_Click()
DAQCounter1.Channel = cmbChannel.ListIndex
End Sub
Private Sub cmbGateMode_Click()
DAQCounter1.GateMode = cmbGateMode.ListIndex
End Sub
Private Sub cmdExit_Click()
Unload Me
End
End Sub
Private Sub cmdScanStart_Click()
If DAQCounter1.OpenDevice Then
MsgBox Adcounter1.ErrorMessage, vbOKOnly
Exit Sub
End If
DAQCounter1.Channel = cmbChannel.ListIndex
DAQCounter1.GateMode = cmbGateMode.ListIndex
DAQCounter1.GatePeriod = Val(txtGatePeriod.Text)
cmdSelectDevice.Enabled = False
cmdScanStart.Enabled = False
cmdScanStop.Enabled = True
DAQCounter1.EnableFrequency True
ScanTimer.Enabled = True
cmdExit.Enabled = False
End Sub
Private Sub cmdScanStop_Click()
ScanTimer.Enabled = False
DAQCounter1.EnableFrequency False
cmdSelectDevice.Enabled = True
cmdScanStart.Enabled = True
cmdScanStop.Enabled = False
cmdExit.Enabled = True
If DAQCounter1.CloseDevice Then
MsgBox Adcounter1.ErrorMessage, vbOKOnly
Exit Sub
End If
End Sub
Private Sub cmdSelectDevice_Click()
Dim Ret As Long
Ret = DAQCounter1.SelectDevice
txtDeviceNum.Text = DAQCounter1.DeviceNumber
txtDeviceName.Text = DAQCounter1.DeviceName
DAQCounter1.DeviceNumber = DAQCounter1.DeviceNumber
DAQCounter1.DeviceName = DAQCounter1.DeviceName
If DAQCounter1.OpenDevice Then
MsgBox DAQCounter1.ErrorMessage, vbOKOnly
Exit Sub
End If
If DAQCounter1.MaxCounterNumber = 0 Then
MsgBox "Function Not Supported", vbOKOnly
Unload Me
End
End If
cmbChannel.Clear
For i = 0 To DAQCounter1.MaxCounterNumber - 1
cmbChannel.AddItem (Str(i))
Next i
If DAQCounter1.MaxCounterNumber Then
cmbChannel.ListIndex = DAQCounter1.Channel
End If
End Sub
Private Sub DAQCounter1_Click()
End Sub
Private Sub Form_Load()
' Select default device
ScanTimer.Enabled = False
Call cmdSelectDevice_Click
txtDeviceNum.Text = DAQCounter1.DeviceNumber
cmdScanStop.Enabled = False
cmbChannel.ListIndex = DAQCounter1.Channel
cmbGateMode.ListIndex = DAQCounter1.GateMode
txtGatePeriod.Text = DAQCounter1.GatePeriod
End Sub
Private Sub Form_Unload(Cancel As Integer)
ScanTimer.Enabled = False
DAQCounter1.EnableFrequency False
DAQCounter1.CloseDevice
End Sub
Private Sub ScanTimer_Timer()
txtFreq(0).Text = DAQCounter1.FrequencyValue
End Sub
Private Sub txtDeviceNum_Change()
DAQCounter1.DeviceNumber = Val(txtDeviceNum.Text)
txtDeviceName.Text = DAQCounter1.DeviceName
End Sub
Private Sub txtScanTime_Change()
ScanTimer.Interval = Val(txtScanTime.Text)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -