📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "运放振荡器计算程序"
ClientHeight = 4230
ClientLeft = 60
ClientTop = 345
ClientWidth = 5700
LinkTopic = "Form1"
ScaleHeight = 4230
ScaleWidth = 5700
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text4
Height = 285
Left = 960
TabIndex = 28
Top = 3840
Width = 4335
End
Begin VB.TextBox Text3
Height = 285
Index = 6
Left = 4320
TabIndex = 19
Text = "0"
Top = 2280
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Index = 5
Left = 4320
TabIndex = 18
Text = "-5"
Top = 1920
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Index = 4
Left = 4320
TabIndex = 17
Text = "5"
Top = 1560
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Index = 3
Left = 4320
TabIndex = 16
Text = "100"
Top = 1200
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Index = 2
Left = 4320
TabIndex = 15
Text = "100"
Top = 840
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Index = 1
Left = 4320
TabIndex = 14
Text = "0.01"
Top = 480
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Index = 0
Left = 4320
TabIndex = 13
Text = "10"
Top = 120
Width = 975
End
Begin VB.TextBox Text2
Height = 285
Left = 960
TabIndex = 12
Top = 3480
Width = 4335
End
Begin VB.TextBox Text1
Height = 285
Left = 960
TabIndex = 11
Top = 3120
Width = 4335
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 375
Left = 3960
TabIndex = 8
Top = 2640
Width = 1335
End
Begin VB.PictureBox Picture1
Height = 2895
Left = 120
Picture = "Form1.frx":0000
ScaleHeight = 2835
ScaleWidth = 3675
TabIndex = 0
Top = 120
Width = 3735
End
Begin VB.Label Label17
Caption = "周期(ms)"
Height = 255
Left = 120
TabIndex = 27
Top = 3840
Width = 735
End
Begin VB.Label Label16
Caption = "V"
Height = 255
Left = 5400
TabIndex = 26
Top = 2280
Width = 255
End
Begin VB.Label Label15
Caption = "V"
Height = 255
Left = 5400
TabIndex = 25
Top = 1920
Width = 255
End
Begin VB.Label Label14
Caption = "V"
Height = 255
Left = 5400
TabIndex = 24
Top = 1560
Width = 255
End
Begin VB.Label Label13
Caption = "K"
Height = 255
Left = 5400
TabIndex = 23
Top = 1200
Width = 255
End
Begin VB.Label Label12
Caption = "K"
Height = 255
Left = 5400
TabIndex = 22
Top = 840
Width = 255
End
Begin VB.Label Label11
Caption = "uF"
Height = 255
Left = 5400
TabIndex = 21
Top = 480
Width = 255
End
Begin VB.Label Label10
Caption = "K"
Height = 255
Left = 5400
TabIndex = 20
Top = 120
Width = 255
End
Begin VB.Label Label9
Caption = "占空比(%)"
Height = 255
Left = 120
TabIndex = 10
Top = 3480
Width = 855
End
Begin VB.Label Label8
Caption = "频率(KHz)"
Height = 255
Left = 120
TabIndex = 9
Top = 3120
Width = 855
End
Begin VB.Label Label7
Caption = "Vi ="
Height = 255
Left = 3960
TabIndex = 7
Top = 2280
Width = 375
End
Begin VB.Label Label6
Caption = "V- ="
Height = 255
Left = 3960
TabIndex = 6
Top = 1920
Width = 375
End
Begin VB.Label Label5
Caption = "V+ ="
Height = 255
Left = 3960
TabIndex = 5
Top = 1560
Width = 375
End
Begin VB.Label Label4
Caption = "Rf ="
Height = 255
Left = 3960
TabIndex = 4
Top = 1200
Width = 375
End
Begin VB.Label Label3
Caption = "Ri ="
Height = 255
Left = 3960
TabIndex = 3
Top = 840
Width = 375
End
Begin VB.Label Label2
Caption = "C ="
Height = 255
Left = 3960
TabIndex = 2
Top = 480
Width = 375
End
Begin VB.Label Label1
Caption = "R ="
Height = 255
Left = 3960
TabIndex = 1
Top = 120
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s(6) As Double
Private Sub Command1_Click()
errtype = 0
On Error GoTo errmsg
For i = 0 To 6
s(i) = Text3(i).Text
Next i
If s(0) <= 0 Then
errtype = 1
i = 0
GoTo errmsg
End If
If s(1) <= 0 Then
errtype = 1
i = 1
GoTo errmsg
End If
If s(2) <= 0 Then
errtype = 1
i = 2
GoTo errmsg
End If
If s(3) <= 0 Then
errtype = 1
i = 3
GoTo errmsg
End If
If s(4) <= s(5) Then
errtype = 2
i = 4
GoTo errmsg
End If
If s(6) >= s(4) Then
errtype = 3
i = 6
GoTo errmsg
End If
If s(6) <= s(5) Then
errtype = 4
i = 6
GoTo errmsg
End If
R = s(0)
C = s(1)
Ri = s(2)
Rf = s(3)
Vp = s(4)
Vn = s(5)
Vi = s(6)
V1 = (Vp * Ri + Vi * Rf) / (Ri + Rf)
V2 = (Vn * Ri + Vi * Rf) / (Ri + Rf)
t1 = R * C * Log((Vp - V2) / (Vp - V1))
t2 = R * C * Log((Vn - V1) / (Vn - V2))
f = 1 / (t1 + t2)
zkb = t1 * 100 / (t1 + t2)
Text1.Text = f
Text2.Text = zkb
Text4.Text = t1 + t2
GoTo enderr
errmsg:
Text3(i).Text = ""
If errtype = 0 Then MsgBox "请输入一个数字"
If errtype = 1 Then MsgBox "该项必须为正"
If errtype = 2 Then MsgBox "V+ 需要大于 V-"
If errtype = 3 Then MsgBox "Vi 需要小于 V+"
If errtype = 4 Then MsgBox "Vi 需要大于 V-"
Text3(i).SetFocus
enderr:
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -