📄 pulseform.vb
字号:
Me.GroupBox2.Controls.Add(Me.Label4)
Me.GroupBox2.Controls.Add(Me.Label3)
Me.GroupBox2.Controls.Add(Me.txtPeriod)
Me.GroupBox2.Controls.Add(Me.cmbGateMode)
Me.GroupBox2.Location = New System.Drawing.Point(16, 96)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(264, 128)
Me.GroupBox2.TabIndex = 6
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Property Settings:"
'
'txtChannel
'
Me.txtChannel.Location = New System.Drawing.Point(80, 24)
Me.txtChannel.Name = "txtChannel"
Me.txtChannel.Size = New System.Drawing.Size(80, 20)
Me.txtChannel.TabIndex = 11
Me.txtChannel.Text = "0"
'
'Label11
'
Me.Label11.Location = New System.Drawing.Point(160, 48)
Me.Label11.Name = "Label11"
Me.Label11.Size = New System.Drawing.Size(96, 16)
Me.Label11.TabIndex = 10
Me.Label11.Text = "(only for PCL830)"
'
'Label10
'
Me.Label10.Location = New System.Drawing.Point(136, 72)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(120, 16)
Me.Label10.TabIndex = 9
Me.Label10.Text = "s(only for PCL830,836)"
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(8, 74)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(72, 16)
Me.Label9.TabIndex = 8
Me.Label9.Text = "UpCycle:"
'
'txtUpCycle
'
Me.txtUpCycle.Location = New System.Drawing.Point(80, 72)
Me.txtUpCycle.Name = "txtUpCycle"
Me.txtUpCycle.Size = New System.Drawing.Size(56, 20)
Me.txtUpCycle.TabIndex = 7
Me.txtUpCycle.Text = "0"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(136, 96)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(24, 16)
Me.Label6.TabIndex = 6
Me.Label6.Text = "ms"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(8, 95)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(64, 16)
Me.Label5.TabIndex = 5
Me.Label5.Text = "Period: "
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(8, 53)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(64, 16)
Me.Label4.TabIndex = 4
Me.Label4.Text = "Gate Mode:"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 32)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 16)
Me.Label3.TabIndex = 3
Me.Label3.Text = "Channel:"
'
'txtPeriod
'
Me.txtPeriod.Location = New System.Drawing.Point(80, 96)
Me.txtPeriod.Name = "txtPeriod"
Me.txtPeriod.Size = New System.Drawing.Size(56, 20)
Me.txtPeriod.TabIndex = 2
Me.txtPeriod.Text = "10"
'
'cmbGateMode
'
Me.cmbGateMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbGateMode.Items.AddRange(New Object() {"no gating", "high level", "low level", "rising edge", "falling edge"})
Me.cmbGateMode.Location = New System.Drawing.Point(80, 48)
Me.cmbGateMode.Name = "cmbGateMode"
Me.cmbGateMode.Size = New System.Drawing.Size(80, 21)
Me.cmbGateMode.TabIndex = 1
'
'DAQPulse1
'
Me.DAQPulse1.Enabled = True
Me.DAQPulse1.Location = New System.Drawing.Point(425, 19)
Me.DAQPulse1.Name = "DAQPulse1"
Me.DAQPulse1.OcxState = CType(resources.GetObject("DAQPulse1.OcxState"), System.Windows.Forms.AxHost.State)
Me.DAQPulse1.Size = New System.Drawing.Size(33, 33)
Me.DAQPulse1.TabIndex = 9
'
'frmPulse
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(496, 237)
Me.Controls.Add(Me.DAQPulse1)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.cmdExit)
Me.MaximizeBox = False
Me.Name = "frmPulse"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Pulse Tester"
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
CType(Me.DAQPulse1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub cmdSelectDevice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelectDevice.Click
DAQPulse1.SelectDevice()
txtDeviceNum.Text = DAQPulse1.DeviceNumber
txtDeviceName.Text = DAQPulse1.DeviceName
End Sub
Private Sub frmCounterTester_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Select Default device
cmdSelectDevice_Click(sender, e)
Timer1.Enabled = False
cmbGateMode.SelectedIndex = 0
cmdStop.Enabled = False
End Sub
Private Sub cmdScanStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
If DAQPulse1.OpenDevice Then
MsgBox(DAQPulse1.ErrorMessage, vbOKOnly)
Exit Sub
End If
DAQPulse1.Channel = txtChannel.Text
DAQPulse1.PulsePeriod = txtPeriod.Text / 1000
DAQPulse1.PulseUpCycle = txtUpCycle.Text
DAQPulse1.GateMode = cmbGateMode.SelectedIndex
DAQPulse1.EnablePulseOut(True)
cmdExit.Enabled = False
cmdStart.Enabled = False
cmdStop.Enabled = True
Timer1.Enabled = True
cmdSelectDevice.Enabled = False
End Sub
Private Sub ScanTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
txtErrorCode.Text = DAQPulse1.ErrorCode
txtError.Text = DAQPulse1.ErrorMessage
End Sub
Private Sub txtCounter_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtErrorCode.TextChanged
End Sub
Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
Application.Exit()
End Sub
Private Sub cmdScanStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStop.Click
Timer1.Enabled = False
DAQPulse1.EnablePulseOut(False)
cmdStop.Enabled = False
cmdStart.Enabled = True
cmdSelectDevice.Enabled = True
If DAQPulse1.CloseDevice Then
MsgBox(DAQPulse1.ErrorMessage, vbOKOnly)
Exit Sub
End If
cmdExit.Enabled = True
End Sub
Private Sub txtScanTime_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPeriod.TextChanged
If isInitializing Then
Exit Sub
End If
DAQPulse1.PulsePeriod = txtPeriod.Text / 1000
DAQPulse1.EnablePulseOut(False)
DAQPulse1.EnablePulseOut(True)
End Sub
Private Sub txtDeviceNum_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDeviceNum.TextChanged
If isInitializing Then
Exit Sub
End If
DAQPulse1.DeviceNumber = Val(txtDeviceNum.Text)
txtDeviceName.Text = DAQPulse1.DeviceName
End Sub
Private Sub cmbChannel_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
If isInitializing Then
Exit Sub
End If
DAQPulse1.Channel = txtChannel.Text
End Sub
Private Sub cmbGateMode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbGateMode.SelectedIndexChanged
If isInitializing Then
Exit Sub
End If
DAQPulse1.GateMode = cmbGateMode.SelectedIndex
End Sub
Private Sub txtUpCycle_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUpCycle.TextChanged
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -