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

📄 test_dy.frm

📁 This is a test ModBus comm s pragam in "STB-311".
💻 FRM
📖 第 1 页 / 共 5 页
字号:
         Top             =   1890
         Width           =   750
      End
      Begin VB.Label Label11 
         BorderStyle     =   1  'Fixed Single
         Height          =   315
         Left            =   -69330
         TabIndex        =   32
         Top             =   2280
         Width           =   1185
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "定值名称:"
         Height          =   240
         Index           =   1
         Left            =   -70650
         TabIndex        =   31
         Top             =   1920
         Width           =   1200
      End
      Begin VB.Label Label12 
         Caption         =   "上传值:"
         Height          =   315
         Index           =   0
         Left            =   -70350
         TabIndex        =   30
         Top             =   2310
         Width           =   915
      End
      Begin VB.Label Label12 
         Caption         =   "整定步长:"
         Height          =   255
         Index           =   1
         Left            =   -70410
         TabIndex        =   29
         Top             =   2760
         Width           =   1005
      End
      Begin VB.Label Label12 
         Caption         =   "上传值:"
         Height          =   315
         Index           =   2
         Left            =   -70410
         TabIndex        =   28
         Top             =   3150
         Width           =   915
      End
   End
   Begin VB.Label Label19 
      Caption         =   "校验"
      Height          =   255
      Left            =   11280
      TabIndex        =   82
      Top             =   3360
      Width           =   1935
   End
   Begin VB.Label Label16 
      Caption         =   " 命令:"
      Height          =   315
      Left            =   2310
      TabIndex        =   17
      Top             =   7170
      Width           =   1065
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "500"
      Height          =   315
      Left            =   5970
      TabIndex        =   12
      Top             =   4800
      Width           =   615
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "接收时间间隔:"
      Height          =   240
      Index           =   3
      Left            =   4230
      TabIndex        =   10
      Top             =   4830
      Width           =   1680
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "端口号:"
      Height          =   240
      Index           =   2
      Left            =   1710
      TabIndex        =   6
      Top             =   5670
      Width           =   960
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "接收串:"
      Height          =   240
      Index           =   1
      Left            =   120
      TabIndex        =   5
      Top             =   2010
      Width           =   960
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "发送串:"
      Height          =   240
      Index           =   0
      Left            =   150
      TabIndex        =   4
      Top             =   480
      Width           =   960
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "命令(十六进制):"
      Height          =   240
      Index           =   1
      Left            =   780
      TabIndex        =   3
      Top             =   5280
      Width           =   1920
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "地址:"
      Height          =   240
      Index           =   0
      Left            =   2010
      TabIndex        =   2
      Top             =   4860
      Width           =   720
   End
End
Attribute VB_Name = "TEST_DY"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Combo1_Click()
On Error Resume Next
MSComm1.PortOpen = False
MSComm1.CommPort = Combo1.ListIndex + 1
MSComm1.PortOpen = True

End Sub

Private Sub Combo2_Click()
Combo3.ListIndex = Combo2.ListIndex
End Sub

Private Sub Combo3_Click()
Combo2.ListIndex = Combo3.ListIndex
End Sub





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






address = Val(Text3.Text)
length = Val("&h" + Text9.Text)
Dzaddr = Val("&h" + Text8.Text)
CMD = Val("&h" + Text10.Text)
S = Send_AEC(address, CMD, Dzaddr, 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 Command10_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim address  As Integer
Dim Point  As Integer
address = Val(Text3.Text)
Main_In_String(1) = ""

Point = Val(Text6.Text)
S = AEC_HZ(address, Point, 1) '读数据
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
   S2 = S
   T = Jiaoyan(S2)
End Sub

Private Sub Command11_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 = ZhiliuYx(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 Command12_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
address = Val(Text3.Text)
length = Val("&h" + Text9.Text)

Ram_addr = Val("&H" + Text8.Text)
If Ram_addr < 0 Then
    Ram_addr = 65536 + Val("&H" + Text8.Text)
End If

DzaddrH = Ram_addr \ &H100
DzaddrL = Ram_addr Mod &H100
CMD = Val("&h" + Text10.Text)
S = Read_Soe(address, DzaddrH, DzaddrL, length)
A = S
In_str = ""
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 Command13_Click()
CRC.Show
End Sub

Private Sub Command14_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 = Reset_AEC(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 Command15_Click()
Dim S() As Byte
Dim S2 As String
Dim A As String
Dim S3 As String
Dim address  As Integer
Dim Point As Integer
address = Val(Text3.Text)
Point = Val(Text6.Text)
 Main_In_String(1) = ""

S = ModBus_Js(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 Command16_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) = ""
 SC_flag = 0
 In_str = ""
With MSFlexGrid3
For i = 1 To 30
.TextMatrix(i, 0) = ""
.TextMatrix(i, 1) = ""

Next i
 .TextMatrix(1, 0) = "速断"
 .TextMatrix(2, 0) = "复闭过流"
 .TextMatrix(3, 0) = "低压闭锁"
 .TextMatrix(4, 0) = "负序电压闭锁"
 .TextMatrix(5, 0) = "过负荷"
 .TextMatrix(6, 0) = "过电压"
 .TextMatrix(7, 0) = "定子接地电压"
 
 .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)

⌨️ 快捷键说明

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