📄 pulse.frm
字号:
VERSION 5.00
Object = "{C8C7D975-EC00-11D2-AAFB-002018650913}#1.1#0"; "Adpulse.ocx"
Begin VB.Form DAQForm
Caption = "脉冲输出"
ClientHeight = 3555
ClientLeft = 45
ClientTop = 270
ClientWidth = 4890
LinkTopic = "Form1"
ScaleHeight = 3555
ScaleWidth = 4890
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdStart
Caption = "开始输出"
Height = 372
Left = 3600
TabIndex = 12
Top = 480
Width = 1095
End
Begin VB.CommandButton cmdStop
Caption = "停止输出"
Height = 372
Left = 3600
TabIndex = 11
Top = 1320
Width = 1095
End
Begin VB.CommandButton cmdExit
Caption = "关闭程序"
Height = 372
Left = 3600
TabIndex = 9
Top = 2160
Width = 1095
End
Begin VB.Timer Timer1
Interval = 100
Left = 3600
Top = 2880
End
Begin VB.Frame Frame2
Caption = "错误信息"
Height = 1455
Left = 120
TabIndex = 5
Top = 1920
Width = 3240
Begin VB.TextBox Text2
Height = 285
Left = 360
TabIndex = 8
Top = 960
Width = 2520
End
Begin VB.TextBox Text1
Height = 285
Left = 360
TabIndex = 7
Top = 480
Width = 2520
End
End
Begin VB.Frame Frame1
Caption = "参数设置"
Height = 1695
Left = 120
TabIndex = 0
Top = 120
Width = 3255
Begin VB.ComboBox cmbGateMode
Height = 300
ItemData = "pulse.frx":0000
Left = 1320
List = "pulse.frx":0002
TabIndex = 3
Top = 1080
Width = 1335
End
Begin VB.TextBox txtPeriod
Height = 288
Left = 1320
TabIndex = 2
Text = "0.1"
Top = 480
Width = 1335
End
Begin VB.Label Label7
Caption = "秒"
Height = 255
Left = 2760
TabIndex = 6
Top = 600
Width = 255
End
Begin VB.Label Label6
Caption = "触发方式:"
Height = 255
Left = 240
TabIndex = 4
Top = 1080
Width = 975
End
Begin VB.Label Label4
Caption = "脉冲周期:"
Height = 255
Left = 240
TabIndex = 1
Top = 480
Width = 1095
End
End
Begin DAQPulseLib.DAQPulse DAQPulse1
Height = 495
Left = 4200
TabIndex = 10
Top = 2880
Width = 495
_Version = 65537
_ExtentX = 864
_ExtentY = 864
_StockProps = 0
End
End
Attribute VB_Name = "DAQForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'程序初始化
Private Sub Form_Load()
Timer1.Enabled = False
cmdStart.Enabled = False
cmdStop.Enabled = False
cmbGateMode.List(0) = "无触发"
cmbGateMode.List(1) = "高电平触发"
cmbGateMode.List(2) = "低电平触发"
cmbGateMode.List(3) = "上升沿触发"
cmbGateMode.List(4) = "下降沿触发"
txtPeriod.Text = DAQPulse1.PulsePeriod
DAQPulse1.SelectDevice
End Sub
'选择触发方式
Private Sub cmbGateMode_Click()
DAQPulse1.GateMode = cmbGateMode.ListIndex
cmdStart.Enabled = True
cmdStop.Enabled = True
End Sub
'开始输出
Private Sub cmdStart_Click()
DAQPulse1.OpenDevice
DAQPulse1.Channel = 0
DAQPulse1.PulseUpCycle = 0.05
DAQPulse1.PulsePeriod = Val(txtPeriod.Text)
DAQPulse1.EnablePulseOut True
Timer1.Enabled = True
End Sub
'停止输出
Private Sub cmdStop_Click()
Timer1.Enabled = False
DAQPulse1.EnablePulseOut False
DAQPulse1.ResetPulse
DAQPulse1.CloseDevice
End Sub
'检测错误信息
Private Sub Timer1_Timer()
Text1.Text = DAQPulse1.ErrorMessage
Text2.Text = DAQPulse1.ErrorCode
End Sub
'退出程序
Private Sub cmdExit_Click()
Unload Me
End
End Sub
'关闭设备
Private Sub Form_Unload(Cancel As Integer)
Timer1.Enabled = False
DAQPulse1.EnablePulseOut False
DAQPulse1.CloseDevice
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -