⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form0.frm

📁 采用VB编写的用于采集PC机串口数据
💻 FRM
📖 第 1 页 / 共 5 页
字号:
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "接地率: "
      Height          =   255
      Left            =   13560
      TabIndex        =   15
      Top             =   3840
      Width           =   975
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "电流: "
      Height          =   255
      Left            =   13560
      TabIndex        =   14
      Top             =   3240
      Width           =   495
   End
   Begin VB.Line Line2 
      X1              =   13560
      X2              =   13560
      Y1              =   1200
      Y2              =   2160
   End
   Begin VB.Line Line1 
      X1              =   13560
      X2              =   15000
      Y1              =   1680
      Y2              =   1680
   End
   Begin VB.Image Image1 
      Height          =   975
      Left            =   13560
      Stretch         =   -1  'True
      Top             =   1200
      Width           =   1455
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "mA"
      Height          =   255
      Left            =   14880
      TabIndex        =   12
      Top             =   3480
      Width           =   255
   End
End
Attribute VB_Name = "Form0"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

'Option Explicit
Public X As Long
Public Y As Long
Public Z As Long
Public A As Long
Dim J As Long
Dim BB(426) As Long
Dim CC(141) As Long


Private Sub Command1_Click()
HScroll1.Value = 2
End Sub

Private Sub Command10_Click()

If Picture2.Visible Then
   
   Picture2.Visible = False
   Command10.Caption = "分 析"
   
Else
   Label41.Visible = True
   If MsgBox("需要一段时间,是否继续?", vbYesNo) = vbNo Then Label41.Visible = False: Exit Sub
   
   Command9_Click
   Picture2.Visible = True
   Command10.Caption = "隐 藏"
   Label41.Visible = False
   
End If
End Sub




Private Sub Command11_Click()
If Command11.Caption = "检测仪表参数设置" Then
   Command11.Caption = "检测仪表设置隐藏"
   Command14.Caption = "信号仪器参数设置"
   Picture3.Visible = True
   Picture4.Visible = False
   Command7_Click
Else
   Command11.Caption = "检测仪表参数设置"
   Picture3.Visible = False
   
End If
End Sub

Private Sub Command12_Click()
DL10 = 20
DL20 = 40
DL30 = 60
DL40 = 90
DL50 = 120
DH10 = 40
DH20 = 60
DH30 = 90
DH40 = 120
DH50 = 150

DRZD = 120

L10 = DL10 / 10
L20 = DL20 / 20
L30 = DL30 / 30
L40 = DL40 / 40
L50 = DL50 / 50

H10 = DH10 / 10
H20 = DH20 / 20
H30 = DH30 / 30
H40 = DH40 / 40
H50 = DH50 / 50

RZD = DRZD


End Sub

Private Sub Command13_Click()
If MsgBox("参数下载,请确认仪器是否刚刚复位?", vbYesNo) = vbNo Then Exit Sub

ReDim CCHR(0) As Byte
MScom.Output = Chr(2) + Chr(3)


Timer5.Enabled = True

End Sub

Private Sub Command14_Click()
If Command14.Caption = "信号仪器参数设置" Then
   Command14.Caption = "信号仪器参数隐藏"
   Command11.Caption = "检测仪表参数设置"
   Picture3.Visible = False
   Picture4.Visible = True
   Command12_Click
Else
   Command14.Caption = "信号仪器参数设置"
   Picture4.Visible = False
   
End If

End Sub

Private Sub Command2_Click()
VScroll1.Value = 1
End Sub


Private Sub Command3_Click()
V.Value = 16383
End Sub


Private Sub Command4_Click()
On Error GoTo EPP
If MScom.PortOpen = True Then MScom.PortOpen = False: S.FillStyle = 1
MScom.CommPort = CInt(P.Text)
MScom.PortOpen = True
S.FillStyle = 0
Exit Sub
EPP:
S.FillStyle = 1

If MScom.PortOpen = True Then MScom.PortOpen = False
MScom.CommPort = 1

End Sub

Private Sub Command5_Click()
Text2.Text = CLng(Text2.Text) + 1
SavePicture Picture1.Image, Trim(Text1.Text) + Trim(Text2.Text) + ".BMP"
     A = Picture1.CurrentY
     
     X = 100
     Y = Picture1.ScaleHeight / 2
     Picture1.Cls
     Picture1.Line (Picture1.ScaleLeft + 100, Picture1.ScaleHeight / 2 - 1 * Picture1.ScaleHeight / 78 / 2)-(Picture1.ScaleWidth - 300, Picture1.ScaleHeight / 2 - 1 * Picture1.ScaleHeight / 78 / 2)

     'Picture1.CurrentX = 100
     'Picture1.CurrentY = 0
     'Picture1.Print "Y/A"
     'Picture1.Print Picture1.ScaleHeight
     'Picture1.CurrentY = Picture1.ScaleHeight / 2
     
     'Picture1.Line (Picture1.ScaleLeft + 100, Picture1.ScaleHeight / 2 + 1 * Picture1.ScaleHeight / 781 / (CInt(Label7.Caption)))-(Picture1.ScaleWidth - 300, Picture1.ScaleHeight / 2 + 1 * Picture1.ScaleHeight / 781 / (CInt(Label7.Caption)))

     'Picture1.Line (Picture1.ScaleLeft + 100, Picture1.ScaleHeight / 2 - 1 * Picture1.ScaleHeight / 781 / (CInt(Label7.Caption)))-(Picture1.ScaleWidth - 300, Picture1.ScaleHeight / 2 - 1 * Picture1.ScaleHeight / 781 / (CInt(Label7.Caption)))
     'Picture1.Line (Picture1.ScaleLeft + 100, Picture1.ScaleHeight / 2)-(Picture1.ScaleWidth - 300, Picture1.ScaleHeight / 2)
     'Picture1.Print "X/T"

     Picture1.CurrentY = A
     L0.Caption = 0
     Text5 = 0
     Text6 = 0
     Text7 = 0
     TC = 0
     CH1 = 0
     CL1 = 0
     CH2 = 0
     CL2 = 0
     TH1 = 0
     TL1 = 0
      TH2 = 0
     TL2 = 0
      TH3 = 0
     TL3 = 0
      TH4 = 0
     TL4 = 0
      TH5 = 0
     TL5 = 0
      TH6 = 0
     TL6 = 0
     For i = 0 To 426
     BB(i) = 0
     Next i
     For i = 0 To 141
     CC(i) = 0
     Next i
     FX = 0
     F1 = 0
     F2 = 0
     F3 = 0
     F4 = 0
     F5 = 0
     Ts = 0
     Text8 = 0
     Text9 = 0
     SUB0 = 0
     T8 = 0
     Text10 = 0
     Text11 = 0
End Sub

Private Sub Command6_Click()
If MsgBox("参数下载,请确认仪器是否刚刚复位?", vbYesNo) = vbNo Then Exit Sub

ReDim CCHR(0) As Byte
MScom.Output = Chr(2) + Chr(3)


Timer4.Enabled = True


End Sub

Private Sub Command7_Click()
DT1 = 60
DT2 = 70
DT3 = 80
DI1 = 2
DI2 = 4
DI3 = 70
DG1 = 10
DG2 = 10
DG3 = 10
DY = 71
DR = 10

T1 = DT1
T2 = DT2
T3 = DT3

I1 = CLng(DI1 * 25000000 / 32767)
I2 = CLng(DI2 * 25000000 / 32767 / 2)
I3 = CLng(DI3 * 25000000 / 32767 / 32)

G1 = CLng(DG1 * 10)
G2 = CLng(DG2 * 10)
G3 = CLng(DG3 * 10)

Y1 = CLng(100 * DY / 71)
Y2 = Y1
Y3 = Y1
R = CLng(DR * 10000 / 256)


End Sub

Private Sub Command8_Click()
CH1 = 0
CL1 = 0
CH2 = 0
CL2 = 0
TH1 = 0
     TL1 = 0
      TH2 = 0
     TL2 = 0
      TH3 = 0
     TL3 = 0
      TH4 = 0
     TL4 = 0
      TH5 = 0
     TL5 = 0
      TH6 = 0
     TL6 = 0
     
     

For i = CInt(T8.Text) To CInt(T8.Text) + 70

If BB(i) > Val(Text6) Then TH1 = TH1 + 1
If BB(i) <= Val(Text6) Then TL1 = TL1 + 1
Next i

For i = CInt(T8.Text) + 71 To CInt(T8.Text) + 141
If BB(i) > Val(Text6) Then TH2 = TH2 + 1
If BB(i) <= Val(Text6) Then TL2 = TL2 + 1
Next i

For i = CInt(T8.Text) + 142 To CInt(T8.Text) + 71 * 2 + 70
If BB(i) > Val(Text6) Then TH3 = TH3 + 1
If BB(i) <= Val(Text6) Then TL3 = TL3 + 1
Next i

For i = CInt(T8.Text) + 213 To CInt(T8.Text) + 71 * 3 + 70
If BB(i) > Val(Text6) Then TH4 = TH4 + 1
If BB(i) <= Val(Text6) Then TL4 = TL4 + 1
Next i

For i = CInt(T8.Text) + 284 To CInt(T8.Text) + 71 * 4 + 70
If BB(i) > Val(Text6) Then TH5 = TH5 + 1
If BB(i) <= Val(Text6) Then TL5 = TL5 + 1
Next i

For i = CInt(T8.Text) + 355 To 425
If BB(i) > Val(Text6) Then TH6 = TH6 + 1
If BB(i) <= Val(Text6) Then TL6 = TL6 + 1
Next i

For i = 0 To CInt(T8.Text) - 1
If BB(i) > Val(Text6) Then TH6 = TH6 + 1
If BB(i) <= Val(Text6) Then TL6 = TL6 + 1
Next i


For i = CInt(T8.Text) To CInt(T8.Text) + 70 '141
If CC(i) > 2 * Val(Text6) Then CH1 = CH1 + 1
If CC(i) <= 2 * Val(Text6) Then CL1 = CL1 + 1
Next i

For i = CInt(T8.Text) + 71 To 141
If CC(i) > 2 * Val(Text6) Then CH2 = CH2 + 1
If CC(i) <= 2 * Val(Text6) Then CL2 = CL2 + 1
Next i


For i = 0 To CInt(T8.Text) - 1
If CC(i) > 2 * Val(Text6) Then CH2 = CH2 + 1
If CC(i) <= 2 * Val(Text6) Then CL2 = CL2 + 1
Next i

FX = Abs(Val(CH1.Text) + Val(CL2.Text) - Val(CH2.Text) - Val(CL1.Text))

F1 = Abs(Val(TH1.Text) + Val(TL2.Text) - Val(TH2.Text) - Val(TL1.Text))

F2 = Abs(Val(TH2.Text) + Val(TL3.Text) - Val(TH3.Text) - Val(TL2.Text))

F3 = Abs(Val(TH3.Text) + Val(TL4.Text) - Val(TH4.Text) - Val(TL3.Text))

F4 = Abs(Val(TH4.Text) + Val(TL5.Text) - Val(TH5.Text) - Val(TL4.Text))

F5 = Abs(Val(TH5.Text) + Val(TL6.Text) - Val(TH6.Text) - Val(TL5.Text))



End Sub

Private Sub Command9_Click()
Command9.Enabled = False
For II = HScroll2.Min To HScroll2.Max
T8 = II
CH1 = 0
CL1 = 0
CH2 = 0
CL2 = 0
TH1 = 0
     TL1 = 0
      TH2 = 0
     TL2 = 0
      TH3 = 0
     TL3 = 0
      TH4 = 0
     TL4 = 0
      TH5 = 0
     TL5 = 0
      TH6 = 0
     TL6 = 0
     
     

For i = CInt(T8.Text) To CInt(T8.Text) + 70

If BB(i) >= Val(Text6) Then TH1 = TH1 + 1
If BB(i) < Val(Text6) Then TL1 = TL1 + 1
Next i

For i = CInt(T8.Text) + 71 To CInt(T8.Text) + 141
If BB(i) >= Val(Text6) Then TH2 = TH2 + 1
If BB(i) < Val(Text6) Then TL2 = TL2 + 1
Next i

For i = CInt(T8.Text) + 142 To CInt(T8.Text) + 71 * 2 + 70

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -