📄 ezsample.frm
字号:
VERSION 5.00
Begin VB.Form frmEZsample
Caption = "Agilent 4334B Sample"
ClientHeight = 6735
ClientLeft = 60
ClientTop = 345
ClientWidth = 6255
LinkTopic = "Form1"
ScaleHeight = 6735
ScaleWidth = 6255
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "Measurements"
Height = 3495
Left = 120
TabIndex = 8
Top = 3000
Width = 6015
Begin VB.CommandButton cmdFetch
Caption = "Using Fetch?(获取数据)"
Height = 375
Left = 3360
TabIndex = 12
Top = 480
Width = 2535
End
Begin VB.TextBox txtReading
Height = 375
Left = 240
TabIndex = 9
TabStop = 0 'False
Top = 480
Width = 3015
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "Make sure there are signals at both counter inputs."
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 120
TabIndex = 14
Top = 2760
Width = 5775
End
Begin VB.Label Label4
Alignment = 2 'Center
Height = 735
Left = 240
TabIndex = 13
Top = 1800
Width = 5535
End
Begin VB.Label Label3
Caption = "Reading 1"
Height = 375
Left = 240
TabIndex = 10
Top = 240
Width = 1335
End
End
Begin VB.TextBox txtAddress
BackColor = &H8000000F&
Enabled = 0 'False
Height = 375
Left = 240
Locked = -1 'True
TabIndex = 7
Text = "GPIB::22"
Top = 480
Width = 3855
End
Begin VB.CommandButton cmdSetIO
Caption = "Set I/O"
Height = 375
Left = 4320
TabIndex = 0
Top = 480
Width = 1815
End
Begin VB.CommandButton cmdRevision
Caption = "Revision"
Height = 375
Left = 4320
TabIndex = 2
Top = 1920
Width = 1815
End
Begin VB.TextBox txtVersion
Height = 375
Left = 240
Locked = -1 'True
TabIndex = 5
TabStop = 0 'False
Top = 1920
Width = 3855
End
Begin VB.TextBox txtID
Height = 375
Left = 240
Locked = -1 'True
TabIndex = 3
TabStop = 0 'False
Top = 1200
Width = 3855
End
Begin VB.CommandButton CmdID
Caption = "Get ID string"
Height = 375
Left = 4320
TabIndex = 1
Top = 1200
Width = 1815
End
Begin VB.Label Label6
Caption = "Address"
Height = 375
Left = 240
TabIndex = 11
Top = 120
Width = 2415
End
Begin VB.Label Label2
Caption = "Revision"
Height = 255
Left = 240
TabIndex = 6
Top = 1680
Width = 2535
End
Begin VB.Label Label1
Caption = "ID string"
Height = 255
Left = 240
TabIndex = 4
Top = 960
Width = 1935
End
End
Attribute VB_Name = "frmEZsample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Cntr As VisaComLib.FormattedIO488
Private Sub cmdFetch_Click()
Dim Frequency() 'As Double
Dim Period As Double
Cntr.WriteString ":Fetc?" ' Ask for the frequency result
Frequency = Cntr.ReadList
txtReading = Frequency(1)
End Sub
Private Sub CmdID_Click()
Dim result As String
Dim IO_type As String
Cntr.WriteString "*idn?"
result = Cntr.ReadString
txtID.Text = result
End Sub
Private Sub cmdRevision_Click()
Dim result As String
Cntr.WriteString ":Syst:Vers?"
result = Cntr.ReadNumber
txtVersion.Text = result
End Sub
Private Sub cmdSetIO_Click()
Dim mgr As VisaComLib.ResourceManager
Dim ioAddress As String
On Error GoTo ioError
ioAddress = txtAddress.Text
ioAddress = InputBox("Enter the IO address of the Counter", "Set IO address", ioAddress)
If Len(ioAddress) > 6 Then
txtAddress.Text = ioAddress
Set mgr = New VisaComLib.ResourceManager
Set Cntr = New VisaComLib.FormattedIO488
Set Cntr.IO = mgr.Open(ioAddress)
txtAddress.Text = ioAddress
End If
Exit Sub
ioError:
MsgBox "Set IO error:" & vbCrLf & Err.Description
End Sub
Private Sub Form_Load()
cmdSetIO_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -