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

📄 test_dy11.frm

📁 This is a test ModBus comm s pragam in "STB-311".
💻 FRM
📖 第 1 页 / 共 4 页
字号:
 .TextMatrix(8, 0) = "失磁电流"
 .TextMatrix(9, 0) = "PT断线电压"
 
 .TextMatrix(10, 0) = "过流I延时"
 .TextMatrix(11, 0) = "过流II延时"
 .TextMatrix(12, 0) = "过流III延时"
 
 .TextMatrix(13, 0) = "过负荷延时"
 .TextMatrix(14, 0) = "过电压延时"
 .TextMatrix(15, 0) = "定子接地延时"
 
 .TextMatrix(16, 0) = "失磁延时"
 .TextMatrix(17, 0) = "PT断线延时"
 
 
 
 
End With

address = Val(Text3.Text)
length = Val("&h" + Text9.Text)
Dzaddr = Val("&h" + Text8.Text)
CMD = Val("&h" + Text10.Text)
Main_In_String(1) = ""
S = Read_Dingzhi(address, 0, &H64, &H24)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
End Sub

Private Sub Command17_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
address = Val(Text3.Text)
length = Val("&h" + Text9.Text)
Dzaddr = Val("&h" + Text8.Text)
CMD = Val("&h" + Text10.Text)
Main_In_String(1) = ""
S = Write_AECDingzhi(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
End Sub

Private Sub Command18_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer


Main_In_String(1) = ""
With MSFlexGrid3
For i = 1 To 30
.TextMatrix(i, 0) = ""
.TextMatrix(i, 1) = ""

Next i
 .TextMatrix(1, 0) = "速断"
 .TextMatrix(2, 0) = "复闭过流I"
 .TextMatrix(3, 0) = "复闭过流II"
 .TextMatrix(4, 0) = "复闭过流III"
 .TextMatrix(5, 0) = "复合电压闭锁"
 .TextMatrix(6, 0) = "过负荷"
 .TextMatrix(7, 0) = "过电压"
 .TextMatrix(8, 0) = "定子接地"
 .TextMatrix(9, 0) = "失磁"
 .TextMatrix(10, 0) = "PT断线"
 .TextMatrix(11, 0) = "零序电流出口"
 .TextMatrix(12, 0) = "零序电压出口"
 
 
 
 End With
 

address = Val(Text3.Text)
length = Val("&h" + Text9.Text)
Dzaddr = Val("&h" + Text8.Text)
CMD = Val("&h" + Text10.Text)
S = Read_Dingzhi(address, 1, &H2C, &HC)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
   SC_flag = 1
End Sub

Private Sub Command19_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim DzaddrL As Integer
Dim DzaddrH As Integer
Dim address  As Integer
Dim Ram_addr As Long

Dim CMD As Integer
Main_In_String(1) = ""
 SC_flag = 0
 In_str = ""

address = Val(Text3.Text)
length = Val("&h" + Text9.Text)
Ram_addr = Val("&H" + Text11.Text)
If Ram_addr < 0 Then
    Ram_addr = 65536 + Val("&H" + Text11.Text)
End If
DzaddrL = Ram_addr Mod &H100
DzaddrH = Ram_addr \ &H100
CMD = Val("&h" + Text10.Text)
Main_In_String(1) = ""
S = Read_Dingzhi(address, DzaddrH, DzaddrL, length)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S  '向传输区写一个字符串
End Sub

Private Sub Command2_Click()
Dim SSS As String
Dim t1 As Integer
Dim t2 As Integer '通道
Dim t3 As Integer
Dim t4 As Integer
Dim S() As Byte
Dim scdk As Integer
If (XC_Page < 1) Or (XC_Weizhi < 1) Then Exit Sub
t1 = Val(Text3.Text)
t2 = Val("&h" + Hex$(XC_Weizhi - 1) + Hex$(XC_Page - 1))
If Val(Text5.Text) <> 0 Then t3 = Val(Text5.Text) / XC_XS
If Text5.Text = "ON" Then t3 = &H1
If Text5.Text = "OFF" Then t3 = 0
If Text5.Text = "ON" Or Text5.Text = "OFF" Then t4 = 1 Else t4 = 2

                  '地址 通道  整定值 属性
SSS = Write_Dingzhi(t1, t2, t3, t4)
For i = 1 To LenB(SSS)
  ppp = ppp + Hex$(AscB(MidB(SSS, i, 1))) + "  "
Next i
    List1.AddItem ppp
    S = SSS
If MSComm1.PortOpen = True Then MSComm1.Output = S

End Sub

Private Sub Command20_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
address = Val(Text3.Text)
length = Val("&h" + Text9.Text)
Dzaddr = Val("&h" + Text8.Text)
CMD = Val("&h" + Text10.Text)
Main_In_String(1) = ""
S = Read_AEC_Command(address, 2, &H20)  '遥信报警
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
End Sub

Private Sub Command21_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyCl_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command22_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_tyDz_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command23_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyHz_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
End Sub

Private Sub Command24_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyAck_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command25_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyReset_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command26_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyFz_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command27_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyYx_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
End Sub

Private Sub Command28_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyQsj_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command29_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TySjfg_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S
End Sub

Private Sub Command3_Click()
Dim S() As Byte
Dim command As Integer
Dim address As Integer
Static V(1 To 4) As Single
Static M_V(1 To 4) As Long
address = Val(Text3.Text)
With MSFlexGrid1(3)
For i = 1 To 4
.Col = 4
.Row = i
 V(i) = Val(.Text)
 If i < 3 Then
 .Row = i + 4
  M_V(i) = Val(.Text)
 End If
Next i
End With
S = set_jfdd(address, V(1), V(2), V(3), V(4))
MSComm1.Output = S
S = Set_Mcdd(address, M_V(1), M_V(2), M_V(3), M_V(4))
MSComm1.Output = S
End Sub

Private Sub Command30_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim length As Integer
Dim Dzaddr As Integer
Dim address  As Integer
Dim CMD As Integer
Main_In_String(1) = ""

address = Val(Text3.Text)
S = Send_TyDs_Command(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
   MSComm1.Output = S

End Sub

Private Sub Command4_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim address  As Integer
address = Val(Text3.Text)
S = Zhiliu(address)
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
 MSComm1.Output = S
End Sub

Private Sub Command5_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim address  As Integer
address = Val(Text3.Text)
S = ZhiliuYc(address) '合闸
A = S
For i = 1 To LenB(A)
          If AscB(MidB(A, i, 1)) > 15 Then SSS1 = SSS1 + Hex(AscB(MidB(A, i, 1))) + " "
          If AscB(MidB(A, i, 1)) < 16 Then SSS1 = SSS1 + "0" + Hex(AscB(MidB(A, i, 1))) + " "
Next i
   If Check1.Value = 0 Then List1.Clear
   List1.AddItem SSS1
   List1.ListIndex = List1.ListCount - 1
 MSComm1.Output = S

⌨️ 快捷键说明

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