📄 mnuldoparametertest.frm
字号:
Private Sub Command10_Click()
Dim sFile As String
CommonDialog1.DialogTitle = "保存"
CommonDialog1.CancelError = False
CommonDialog1.Filter = "设置文件 (*.dat)|*.dat"
CommonDialog1.ShowSave
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
sFile = CommonDialog1.FileName
Open sFile For Output As #1 '
Close #1
End Sub
Private Sub Command11_Click()
Dim sFile As String
CommonDialog1.DialogTitle = "打开"
CommonDialog1.CancelError = False
CommonDialog1.Filter = "设置文件 (*.dat)|*.dat"
CommonDialog1.ShowOpen
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
sFile = CommonDialog1.FileName
Open sFile For Input As #1 '装载源代码
Close #1
End Sub
Private Sub Command1_Click() '第1项测试
outvoltagetestflag = False
Label20.ForeColor = vbBlack
hp6611crst
hp6611csetvoltage (1.8)
hp6611coutputon
keithley2400rst
keithley2400setcurrent (-0.04)
keithley2400outputon
hp34401arst
Text2.Text = hp34401ameasuredcvoltage
If outvoltagetestcheck Then '若选,则开始测试
If outvoltagetestflag Then
Label20.ForeColor = vbGreen
Else
Label20.ForeColor = vbRed
End If
Else '否则置测试标志为真
outvoltagetestflag = True
End If
End Sub
Private Sub Command2_Click()
maxoutcurrentestflag = False
Label30.ForeColor = vbBlack
Dim i, j As Single
hp6611crst
hp6611csetvoltage (4.3)
hp6611coutputon
j = 0.001
i = 3.3
Do Until (i <= 3.3 * 0.98)
keithley2400rst
keithley2400setcurrent (-j)
keithley2400outputon
i = hp34401ameasuredcvoltage
j = 0.001 + j
delay 1
Loop
Text4.Text = j
If maxoutcurrentestcheck Then
If maxoutcurrentestflag Then
Label30.ForeColor = vbGreen
Else
Label30.ForeColor = vbRed
End If
Else
maxoutcurrentestflag = True
End If
End Sub
Private Sub Command3_Click()
Dim i, i1 As Single
loadregulationtestflag = False
Label37.ForeColor = vbBlack
hp6611crst
hp6611csetvoltage (4.3)
hp6611coutputon
keithley2400rst
keithley2400setcurrent (-0.001)
keithley2400outputon
hp34401arst
i = hp34401ameasuredcvoltage
delay 100
keithley2400rst
keithley2400setcurrent (-0.1)
keithley2400outputon
hp34401arst
i1 = hp34401ameasuredcvoltage
Text5.Text = i - i1
If loadregulationtestcheck Then
If loadregulationtestflag Then
Label37.ForeColor = vbGreen
Else
Label37.ForeColor = vbRed
End If
Else
loadregulationtestflag = True
End If
End Sub
Private Sub Command4_Click()
dropoutvoltagetestflag = False
Label38.ForeColor = vbBlack
Dim i, j As Single
keithley2400rst
keithley2400setcurrent (-0.03)
keithley2400outputon
If dropoutvoltagetestcheck Then
If dropoutvoltagetestflag Then
Label38.ForeColor = vbGreen
Else
Label38.ForeColor = vbRed
End If
Else
dropoutvoltagetestflag = True
End If
End Sub
Private Sub Command5_Click()
supplycurrenttestflag = False
Label54.ForeColor = vbBlack
If supplycurrenttestcheck Then
If supplycurrenttestflag Then
Label54.ForeColor = vbGreen
Else
Label54.ForeColor = vbRed
End If
Else
supplycurrenttestflag = True
End If
End Sub
Private Sub Command6_Click()
lineregulationtestflag = False
Label63.ForeColor = vbBlack
Dim i, j As Single
keithley2400rst
keithley2400setcurrent (-0.04)
keithley2400outputon
hp6611crst
hp6611csetvoltage (3.5)
hp6611coutputon
hp34401arst
i = hp34401ameasuredcvoltage
hp6611crst
hp6611csetvoltage (6)
hp6611coutputon
hp34401arst
j = hp34401ameasuredcvoltage
Text9.Text = (i - j) / (6 - 3.5) / 2.5
If lineregulationtestcheck Then
If lineregulationtestflag Then
Label63.ForeColor = vbGreen
Else
Label63.ForeColor = vbRed
End If
Else
lineregulationtestflag = True
End If
End Sub
Private Sub Command7_Click()
inputvoltagetestflag = False
Label68.ForeColor = vbBlack
If inputvoltagetestcheck Then
If inputvoltagetestflag Then
Label68.ForeColor = vbGreen
Else
Label68.ForeColor = vbRed
End If
Else
inputvoltagetestflag = True
End If
End Sub
Private Sub Command8_Click()
currentlimitertestflag = False
Label74.ForeColor = vbBlack
If currentlimitertestcheck Then
If currentlimitertestflag Then
Label74.ForeColor = vbGreen
Else
Label74.ForeColor = vbRed
End If
Else
currentlimitertestflag = True
End If
End Sub
Private Sub Command9_Click()
alltestflag = False
Label75.ForeColor = vbBlack
If outvoltagetestcheck Then
Command1_Click
Else
End If
If maxoutcurrentestcheck Then
Command2_Click
Else
End If
If loadregulationtestcheck Then
Command3_Click
Else
End If
If dropoutvoltagetestcheck Then
Command4_Click
Else
End If
If supplycurrenttestcheck Then
Command5_Click
Else
End If
If lineregulationtestcheck Then
Command6_Click
Else
End If
If inputvoltagetestcheck Then
Command7_Click
Else
End If
If currentlimitertestcheck Then
Command8_Click
Else
End If
If outvoltagetestflag And maxoutcurrentestflag And loadregulationtestflag And dropoutvoltagetestflag And supplycurrenttestflag And lineregulationtestflag And inputvoltagetestflag And currentlimitertestflag Then
alltestflag = True
Else
alltestflag = False
End If
If alltestflag Then
Label75.ForeColor = vbGreen
Else
Label75.ForeColor = vbRed
End If
End Sub
Private Sub Form_Load()
Dim i As Single
'文字框初始
Text1.Text = "" '输出电压/最小值
Text2.Text = "" '输出电压/标准值
Text3.Text = "" '输出电压/最大值
Text4.Text = "" '最大输出电流/最小电流
Text5.Text = "" '负载调整率/典型值
Text6.Text = "" '压差1/典型值
Text7.Text = "" '压差2/典型值
Text8.Text = "" '静耗电流/典型值
Text9.Text = "" '线性调整率/典型值
Text10.Text = "" '输入电压/最小值
Text11.Text = "" '输入电压/最大值
Text12.Text = "" '极限电流/典型值
'下拉框初始
Combo1.Text = "" '器件输出电压
Combo2.Text = "" '输出电压/输入电压
Combo3.Text = "" '输出电压/给定电流
Combo4.Text = "" '最大输出电流/输入电压
Combo5.Text = "" '最大输出电流/标准输出电压
Combo6.Text = "" '负载/输入电压
Combo7.Text = "" '负载调整率/给定最小电流
Combo8.Text = "" '负载调整率/给定最大电流
Combo9.Text = "" '压差1/给定电流
Combo10.Text = "" '压差1/输入电压
Combo11.Text = "" '压差2/给定电流
Combo12.Text = "" '压差2输入电压
Combo13.Text = "" '静耗电流/输入电压
Combo14.Text = "" '线性调整率/标准输入电压
Combo15.Text = "" '线性调整率/最大输出电流
Combo16.Text = "" '线性调整率/给定电流
Combo17.Text = "" '极限输出电流/标准输入电压
Combo18.Text = "" '极限输出电流/偏移电压
'加范围值
For i = 0# To 5# Step 0.1
Combo1.AddItem " " + Format(i, "0.0") + " V" '器件输出电压
Combo2.AddItem " " + Format(i, "0.0") + " V"
Combo4.AddItem " " + Format(i, "0.0") + " V"
Combo5.AddItem " " + Format(i, "0.0") + " V"
Combo6.AddItem " " + Format(i, "0.0") + " V"
Combo10.AddItem " " + Format(i, "0.0") + " V"
Combo12.AddItem " " + Format(i, "0.0") + " V"
Combo13.AddItem " " + Format(i, "0.0") + " V"
Combo14.AddItem " " + Format(i, "0.0") + " V"
Combo15.AddItem " " + Format(i, "0.0") + " V"
Combo17.AddItem " " + Format(i, "0.0") + " V"
Combo18.AddItem " " + Format(i, "0.0") + " V"
Next i
'加流范围
For i = 0 To 200
Combo3.AddItem "" + Format(i, "0") + " mA" '输出电压/给定电流
Combo7.AddItem "" + Format(i, "0") + " mA" '负载调整率/给定最小电流
Combo8.AddItem "" + Format(i, "0") + " mA" '负载调整率/给定最大电流
Combo9.AddItem "" + Format(i, "0") + " mA" '压差1/给定电流
Combo11.AddItem "" + Format(i, "0") + " mA" '压差2/给定电流
Combo16.AddItem "" + Format(i, "0") + " mA" '线性调整率/给定电流
Next i
'复选框初始
Check1.value = 1 '输出电压测试选择
Check2.value = 1 '最大输出电流测试选择
Check3.value = 1 '负载调整率测试选择
Check4.value = 1 '压差测试选择
Check5.value = 1 '静耗测试选择
Check6.value = 1 '线性调整率测试选择
Check7.value = 1 '输入电压测试选择
Check8.value = 1 '电流极限测试选择
'测试始能选择
If Check1.value Then
outvoltagetestcheck = True
Else
outvoltagetestcheck = False
End If
If Check2.value Then
maxoutcurrentestcheck = True
Else
maxoutcurrentestcheck = False
End If
If Check3.value Then
loadregulationtestcheck = True
Else
loadregulationtestcheck = False
End If
If Check4.value Then
dropoutvoltagetestcheck = True
Else
dropoutvoltagetestcheck = False
End If
If Check5.value Then
supplycurrenttestcheck = True
Else
supplycurrenttestcheck = False
End If
If Check6.value Then
lineregulationtestcheck = True
Else
lineregulationtestcheck = False
End If
If Check7.value Then
inputvoltagetestcheck = True
Else
inputvoltagetestcheck = False
End If
If Check8.value Then
currentlimitertestcheck = True
Else
currentlimitertestcheck = False
End If
'测试结果颜色初始
Label20.ForeColor = vbBlack
Label30.ForeColor = vbBlack
Label37.ForeColor = vbBlack
Label38.ForeColor = vbBlack
Label54.ForeColor = vbBlack
Label63.ForeColor = vbBlack
Label68.ForeColor = vbBlack
Label74.ForeColor = vbBlack
'测试结果标志初始
outvoltagetestflag = False
maxoutcurrentestflag = False
loadregulationtestflag = False
dropoutvoltagetestflag = False
supplycurrenttestflag = False
lineregulationtestflag = False
inputvoltagetestflag = False
currentlimitertestflag = False
alltestflag = False
'调入上次设置参数
Open App.Path + "\" + "back.dat" For Input As #1
Close #1
keithley2400open
hp6611copen
hp34401aopen
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
keithley2400outputoff
Open App.Path + "\" + "back.dat" For Output As #1 '装载源代码
Close #1
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -