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

📄 test_dy11.frm

📁 This is a test ModBus comm s pragam in "STB-311".
💻 FRM
📖 第 1 页 / 共 4 页
字号:
      End
      Begin VB.PictureBox MSFlexGrid2 
         Height          =   3345
         Left            =   -74880
         ScaleHeight     =   3285
         ScaleWidth      =   3825
         TabIndex        =   22
         Top             =   660
         Width           =   3885
      End
      Begin VB.PictureBox MSFlexGrid1 
         Height          =   2715
         Index           =   1
         Left            =   -74910
         ScaleHeight     =   2655
         ScaleWidth      =   7155
         TabIndex        =   26
         Top             =   780
         Width           =   7215
      End
      Begin VB.PictureBox MSFlexGrid1 
         Height          =   2115
         Index           =   3
         Left            =   -74850
         ScaleHeight     =   2055
         ScaleWidth      =   5775
         TabIndex        =   27
         Top             =   900
         Width           =   5835
      End
      Begin VB.PictureBox MSFlexGrid3 
         Height          =   3735
         Left            =   -69720
         ScaleHeight     =   3675
         ScaleWidth      =   3105
         TabIndex        =   79
         Top             =   720
         Width           =   3165
      End
      Begin VB.Label Label15 
         AutoSize        =   -1  'True
         Caption         =   "测量数据地址:"
         Height          =   240
         Index           =   1
         Left            =   3360
         TabIndex        =   84
         Top             =   600
         Width           =   1680
      End
      Begin VB.Label Label18 
         AutoSize        =   -1  'True
         Caption         =   "点号:"
         Height          =   240
         Left            =   900
         TabIndex        =   58
         Top             =   1590
         Width           =   720
      End
      Begin VB.Label Label17 
         AutoSize        =   -1  'True
         Caption         =   "读入长度:"
         Height          =   240
         Left            =   1560
         TabIndex        =   52
         Top             =   1020
         Width           =   1200
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "命令(十六进制):"
         Height          =   240
         Index           =   4
         Left            =   3120
         TabIndex        =   51
         Top             =   1620
         Width           =   1920
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "0"
         Height          =   240
         Left            =   7440
         TabIndex        =   48
         Top             =   750
         Width           =   120
      End
      Begin VB.Label Label14 
         AutoSize        =   -1  'True
         Caption         =   "接收串长"
         Height          =   240
         Left            =   6360
         TabIndex        =   47
         Top             =   780
         Width           =   960
      End
      Begin VB.Label Label15 
         AutoSize        =   -1  'True
         Caption         =   "SOE数据地址:"
         Height          =   240
         Index           =   0
         Left            =   480
         TabIndex        =   46
         Top             =   600
         Width           =   1560
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         BorderStyle     =   1  'Fixed Single
         Caption         =   " "
         Height          =   300
         Left            =   -69960
         TabIndex        =   39
         Top             =   750
         Width           =   1980
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "下传页号:"
         Height          =   240
         Left            =   -70470
         TabIndex        =   38
         Top             =   1170
         Width           =   1080
      End
      Begin VB.Label Label8 
         BorderStyle     =   1  'Fixed Single
         Height          =   300
         Left            =   -69300
         TabIndex        =   37
         Top             =   1140
         Width           =   720
      End
      Begin VB.Label Label9 
         BorderStyle     =   1  'Fixed Single
         Height          =   300
         Left            =   -69300
         TabIndex        =   36
         Top             =   1500
         Width           =   720
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "名称:"
         Height          =   240
         Index           =   0
         Left            =   -70740
         TabIndex        =   35
         Top             =   810
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "序号:"
         Height          =   240
         Index           =   0
         Left            =   -70200
         TabIndex        =   34
         Top             =   1530
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         BorderStyle     =   1  'Fixed Single
         Height          =   300
         Left            =   -69300
         TabIndex        =   33
         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) = "定子接地电压"
 

⌨️ 快捷键说明

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