📄 frmthermo.frm
字号:
VERSION 5.00
Object = "{624EC978-8E3A-11D2-A9C9-002018650913}#1.1#0"; "adain.ocx"
Begin VB.Form frmThermo
Caption = "Thermo Tester"
ClientHeight = 5220
ClientLeft = 45
ClientTop = 330
ClientWidth = 6975
LinkTopic = "Form1"
ScaleHeight = 5220
ScaleWidth = 6975
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame4
Caption = "Thermo Read:"
Height = 3612
Left = 3900
TabIndex = 9
Top = 1440
Width = 2895
Begin VB.TextBox txtSampleNumber
Height = 372
Left = 240
TabIndex = 26
Text = "0"
Top = 3070
Width = 2292
End
Begin VB.TextBox txtThermoReading
Height = 372
Left = 240
TabIndex = 22
Top = 2280
Width = 2292
End
Begin VB.HScrollBar hscrlFreq
Height = 252
Left = 240
Max = 100
TabIndex = 19
Top = 1080
Value = 10
Width = 2292
End
Begin VB.CommandButton cmdThermoStop
Caption = "St&op"
Enabled = 0 'False
Height = 375
Left = 1440
TabIndex = 11
ToolTipText = "Stop Auto Scan"
Top = 360
Width = 1095
End
Begin VB.CommandButton cmdThermoStart
Caption = "St&art"
Height = 375
Left = 240
TabIndex = 10
ToolTipText = "Star Auto Scan"
Top = 360
Width = 1095
End
Begin VB.Timer ScanTimer
Left = 2400
Top = 480
End
Begin VB.Label Label13
Caption = "100 time/s"
Height = 255
Left = 1920
TabIndex = 27
Top = 1440
Width = 855
End
Begin VB.Label Label10
Caption = "Sample Number:"
Height = 252
Left = 240
TabIndex = 25
Top = 2760
Width = 1332
End
Begin VB.Label Label8
Caption = "0"
Height = 255
Left = 240
TabIndex = 23
Top = 1440
Width = 255
End
Begin VB.Label Label6
Caption = "Thermo Reading:"
Height = 252
Left = 240
TabIndex = 21
Top = 1920
Width = 1452
End
Begin VB.Label Label5
Caption = "Polling Rate:"
Height = 252
Left = 240
TabIndex = 20
Top = 840
Width = 972
End
End
Begin VB.Frame chou2121
Caption = "Property Settings:"
Height = 3612
Left = 120
TabIndex = 7
Top = 1440
Width = 3585
Begin VB.ComboBox cmbDasChannel
Height = 315
Left = 1680
TabIndex = 24
Top = 1440
Width = 1572
End
Begin VB.TextBox txtDaughterName
Height = 405
Left = 1680
TabIndex = 18
Top = 2610
Width = 1572
End
Begin VB.CommandButton cmbSelectDaughter
Caption = "Select Daughter"
Height = 372
Left = 1680
TabIndex = 16
Top = 2160
Width = 1572
End
Begin VB.ComboBox cmbDaughterChannel
Height = 315
Left = 1680
TabIndex = 14
Top = 3120
Width = 1572
End
Begin VB.ComboBox cmbThermoScale
Height = 315
Left = 1680
TabIndex = 13
Top = 1107
Width = 1572
End
Begin VB.ComboBox cmbThermoType
Height = 315
Left = 1680
TabIndex = 12
Top = 720
Width = 1572
End
Begin VB.ComboBox cmbInputRange
Height = 315
Left = 1680
TabIndex = 8
ToolTipText = "Input voltage range"
Top = 360
Width = 1575
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Input Range(Gain):"
Height = 192
Left = 240
TabIndex = 32
Top = 480
Width = 1332
End
Begin VB.Label Label7
Caption = "Thermo Type:"
Height = 252
Left = 240
TabIndex = 31
Top = 800
Width = 1212
End
Begin VB.Label Label9
Caption = "Thermo Scale:"
Height = 252
Left = 240
TabIndex = 30
Top = 1180
Width = 1092
End
Begin VB.Label Label11
Caption = "Das Channel:"
Height = 255
Left = 240
TabIndex = 29
Top = 1560
Width = 1335
End
Begin VB.Line Line1
BorderWidth = 3
X1 = 120
X2 = 3360
Y1 = 2040
Y2 = 2040
End
Begin VB.Label Label4
Caption = "Daughter Name:"
Height = 255
Left = 240
TabIndex = 17
Top = 2760
Width = 1335
End
Begin VB.Label Label12
Caption = "Daughter Channel:"
Height = 252
Left = 240
TabIndex = 15
Top = 3120
Width = 1452
End
End
Begin VB.CommandButton cmdExit
Caption = "&Close"
Height = 375
Left = 5640
TabIndex = 6
ToolTipText = "Close application"
Top = 840
Width = 1095
End
Begin DAQAILib.DAQAI DAQAI1
Height = 495
Left = 6000
TabIndex = 28
Top = 240
Width = 495
_Version = 65537
_ExtentX = 864
_ExtentY = 864
_StockProps = 0
End
Begin VB.Frame Frame1
Caption = "Select Device :"
Height = 1185
Left = 120
TabIndex = 0
Top = 120
Width = 5295
Begin VB.TextBox txtDeviceNum
Height = 285
Left = 1270
TabIndex = 3
Text = "-100"
ToolTipText = "Device Number"
Top = 300
Width = 855
End
Begin VB.TextBox txtDeviceName
Height = 285
Left = 1270
TabIndex = 2
Text = "AdvanTech"
ToolTipText = "Device Name"
Top = 720
Width = 3735
End
Begin VB.CommandButton cmdSelectDevice
Caption = "&Select Device"
Default = -1 'True
Height = 375
Left = 3555
TabIndex = 1
ToolTipText = "Selecting device to operation"
Top = 240
Width = 1455
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Device No. :"
Height = 195
Left = 140
TabIndex = 5
Top = 365
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Device Name :"
Height = 195
Left = 140
TabIndex = 4
Top = 765
Width = 1065
End
End
End
Attribute VB_Name = "frmThermo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmbInputRange_Click()
DAQAI1.ThermoDasGain = cmbInputRange.ListIndex
End Sub
Private Sub cmbDasChannel_Click()
DAQAI1.ThermoDasChannel = cmbDasChannel.ListIndex
End Sub
Private Sub cmbDaughterChannel_Click()
DAQAI1.DaughterChannel = cmbDaughterChannel.ListIndex
End Sub
Private Sub cmbSelectDaughter_Click()
DAQAI1.SelectDaughter
txtDaughterName.Enabled = True
cmbDaughterChannel.Enabled = True
cmbDaughterChannel.Clear
For j = 0 To 31
cmbDaughterChannel.AddItem (Str(j))
Next j
txtDaughterName.Text = DAQAI1.DaughterName
cmbDaughterChannel.ListIndex = 0
End Sub
Private Sub cmbThermoScale_Click()
DAQAI1.ThermoScale = cmbThermoScale.ListIndex
End Sub
Private Sub cmbThermoType_Click()
DAQAI1.ThermoType = cmbThermoType.ListIndex
End Sub
Private Sub Form_Load()
' Select default device
Call cmdSelectDevice_Click
' Setting initial value
txtDeviceNum.Text = DAQAI1.DeviceNumber
txtDeviceName.Text = DAQAI1.DeviceName
' Add selectable items of Thermocouple type
cmbThermoType.AddItem "J type" ' 0
cmbThermoType.AddItem "K type" ' 1
cmbThermoType.AddItem "S type" ' 2
cmbThermoType.AddItem "T type" ' 3
cmbThermoType.AddItem "B type" ' 4
cmbThermoType.AddItem "R type" ' 5
cmbThermoType.AddItem "E type" ' 6
' Set the default selection of thermocouple type
cmbThermoType.ListIndex = 0
DAQAI1.ThermoType = 0
' Add selectable items of Thermocouple scale
cmbThermoScale.AddItem "C" ' 0
cmbThermoScale.AddItem "F" ' 1
cmbThermoScale.AddItem "R" ' 2
cmbThermoScale.AddItem "K" ' 3
' Set the default selection of thermocouple type
cmbThermoScale.ListIndex = 0
DAQAI1.ThermoScale = 0
' Disable Daughter Board
txtDaughterName.Text = DAQAI1.DaughterName
txtDaughterName.Enabled = False
cmbDaughterChannel.Enabled = False
End Sub
Private Sub cmdSelectDevice_Click()
Dim i As Integer
Dim j As Integer
Dim bRet As Boolean
DAQAI1.SelectDevice
txtDeviceNum.Text = DAQAI1.DeviceNumber
txtDeviceName.Text = DAQAI1.DeviceName
DAQAI1.DeviceNumber = DAQAI1.DeviceNumber
DAQAI1.DeviceName = DAQAI1.DeviceName
cmbInputRange.Clear
' Open device
If DAQAI1.OpenDevice Then
MsgBox DAQAI1.ErrorMessage, vbOKOnly
Exit Sub
End If
' Get input range list
bRet = DAQAI1.GetInputRange(gNumOfInputRange, gInputRangeList)
For j = 0 To gNumOfInputRange - 1
cmbInputRange.AddItem gInputRangeList(j)
Next j
If gNumOfInputRange <> 0 Then
cmbInputRange.ListIndex = 0
DAQAI1.ThermoDasGain = 0
End If
' Get Max. channel number
If DAQAI1.MaxDifferentialChannel > DAQAI1.MaxSingleEndedChannel Then
i = DAQAI1.MaxDifferentialChannel
Else
i = DAQAI1.MaxSingleEndedChannel
End If
If i = 0 Then
MsgBox "Function Not Supported", vbOKOnly
Unload Me
End
End If
cmbDasChannel.Clear
For j = 0 To i - 1
cmbDasChannel.AddItem (Str(j))
Next j
If i <> 0 Then
cmbDasChannel.ListIndex = 0
End If
DAQAI1.CloseDevice
End Sub
Private Sub cmdThermoStart_Click()
If DAQAI1.OpenDevice Then
MsgBox DAQAI1.ErrorMessage, vbOKOnly
Exit Sub
End If
cmdSelectDevice.Enabled = False
cmdThermoStart.Enabled = False
cmdThermoStop.Enabled = True
cmdExit.Enabled = False
' Start getting data
gReading = True
hscrlFreq_Change
End Sub
Private Sub cmdThermoStop_Click()
' Stop get data
gReading = False
' Close device
DAQAI1.CloseDevice
cmdSelectDevice.Enabled = True
cmdThermoStart.Enabled = True
cmdThermoStop.Enabled = False
cmdExit.Enabled = True
End Sub
Private Sub cmdExit_Click()
Unload Me
End
End Sub
Private Sub Form_Unload(Cancel As Integer)
gReading = False
DAQAI1.CloseDevice
End Sub
Private Sub hscrlFreq_Change()
If hscrlFreq.Value = 0 Then
ScanTimer.Interval = 0
Else
ScanTimer.Interval = 1000 / hscrlFreq.Value
End If
End Sub
Private Sub ScanTimer_Timer()
If gReading Then
txtThermoReading.Text = Str(DAQAI1.ThermoRead)
gSampleNumber = gSampleNumber + 1
txtSampleNumber.Text = Str(gSampleNumber)
End If
End Sub
Private Sub txtDeviceNum_Change()
DAQAI1.DeviceNumber = Val(txtDeviceNum.Text)
txtDeviceName.Text = DAQAI1.DeviceName
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -