📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "DVP TEST PC---->PLC(V1.0)"
ClientHeight = 7065
ClientLeft = 60
ClientTop = 345
ClientWidth = 6630
Icon = "Form1.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 7065
ScaleWidth = 6630
StartUpPosition = 1 '所有者中心
Begin MSCommLib.MSComm COMM
Left = 6000
Top = 5805
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
RThreshold = 1
ParitySetting = 2
DataBits = 7
SThreshold = 13
End
Begin VB.Timer Timer1
Interval = 100
Left = 4440
Top = 2880
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 28
Top = 6690
Width = 6630
_ExtentX = 11695
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 9701
MinWidth = 9701
Text = "DVP TEST PC---->PLC(V1.0) Communication rate is 0"
TextSave = "DVP TEST PC---->PLC(V1.0) Communication rate is 0"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
MousePointer = 1
End
Begin VB.Frame Frame4
Caption = "DATA"
Height = 975
Left = 120
TabIndex = 21
Top = 2700
Width = 6375
Begin VB.CommandButton Command5
Caption = "SEND"
Height = 375
Left = 5190
TabIndex = 26
ToolTipText = "Send the data to PLC"
Top = 390
Width = 1005
End
Begin VB.TextBox Text6
Enabled = 0 'False
Height = 375
Left = 3600
TabIndex = 25
Text = "CRLF"
Top = 360
Width = 1095
End
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 375
Left = 2400
TabIndex = 24
Top = 360
Width = 1215
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 375
Left = 480
TabIndex = 23
Top = 360
Width = 1935
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 120
TabIndex = 22
Text = ":"
Top = 360
Width = 375
End
End
Begin VB.Frame Frame3
Caption = "COMMAND"
Height = 1575
Left = 120
TabIndex = 11
Top = 1110
Width = 6375
Begin VB.TextBox Text7
Enabled = 0 'False
Height = 270
Left = 3120
TabIndex = 31
Top = 1080
Width = 975
End
Begin VB.CommandButton Command1
Caption = "MAKE DATA"
Height = 375
Left = 5220
TabIndex = 20
ToolTipText = "Make the data of select"
Top = 1050
Width = 975
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form1.frx":030A
Left = 960
List = "Form1.frx":0326
TabIndex = 19
Text = "01"
Top = 360
Width = 1335
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 270
Left = 5160
TabIndex = 17
Text = "0001"
Top = 360
Width = 975
End
Begin VB.TextBox Text1
Height = 270
Left = 3120
TabIndex = 15
Top = 360
Width = 975
End
Begin VB.ComboBox ComObj
Height = 300
ItemData = "Form1.frx":034A
Left = 840
List = "Form1.frx":035D
TabIndex = 13
Text = "S"
Top = 1080
Width = 1455
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "DATA:"
Height = 180
Left = 2520
TabIndex = 30
Top = 1200
Width = 450
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "Read Coil Status"
Height = 180
Left = 960
TabIndex = 27
Top = 840
Width = 1440
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "OPTATION:"
Height = 180
Left = 120
TabIndex = 18
Top = 480
Width = 810
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "LENGTH:"
Height = 180
Left = 4320
TabIndex = 16
Top = 480
Width = 630
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "START:"
Height = 180
Left = 2520
TabIndex = 14
Top = 480
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "OBJECT:"
Height = 180
Left = 120
TabIndex = 12
Top = 1200
Width = 630
End
End
Begin VB.Frame Frame2
Caption = "SET COMMUNICATIONS"
Height = 975
Left = 120
TabIndex = 4
Top = 120
Width = 6375
Begin VB.CommandButton CmdCon
Caption = "CONNECT"
Height = 375
Left = 5160
TabIndex = 9
ToolTipText = "Connect to PLC"
Top = 360
Width = 1005
End
Begin VB.ComboBox ComRate
Height = 300
ItemData = "Form1.frx":0370
Left = 3120
List = "Form1.frx":0389
TabIndex = 8
Text = "9600"
Top = 480
Width = 1575
End
Begin VB.ComboBox ComPort
Height = 300
ItemData = "Form1.frx":03B7
Left = 840
List = "Form1.frx":03C1
TabIndex = 7
Text = "1"
Top = 480
Width = 1455
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "RATE:"
Height = 180
Left = 2640
TabIndex = 6
Top = 600
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "PORT:"
Height = 180
Left = 240
TabIndex = 5
Top = 600
Width = 450
End
End
Begin VB.Frame Frame1
Caption = "DO PLC"
Height = 945
Left = 120
TabIndex = 1
Top = 5670
Width = 6375
Begin VB.CommandButton Command8
Caption = "Test"
Height = 375
Left = 120
TabIndex = 32
Top = 390
Width = 1035
End
Begin VB.CommandButton Command6
Caption = "CUT"
Height = 375
Left = 3750
TabIndex = 29
Top = 390
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "CLEAR"
Height = 375
Left = 4920
TabIndex = 10
Top = 360
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "START"
Height = 375
Left = 1290
TabIndex = 2
ToolTipText = "START THE DVP--PLC"
Top = 390
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "STOP"
Height = 375
Left = 2550
TabIndex = 3
ToolTipText = "STOP THE DVP--PLC"
Top = 390
Width = 1095
End
End
Begin VB.ListBox List1
Height = 1860
Left = 120
TabIndex = 0
Top = 3720
Width = 6375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public str As String
Public str_out As String
Public str_cmm As String
Public str_device As String
Public lrc As String
Dim getstr As String
Dim str_Com As String
Dim str_Data As String
Dim str_SumData As String
Dim str_Temp As String
Dim blnTest As Boolean
Dim SendSpeed, SendBao1, SendBao As Long
Dim SendTime1, SendTime As Long
Private Sub CmdCon_Click()
On Error GoTo err
If COMM.PortOpen = True Then
COMM.PortOpen = False
End If
COMM.Settings = ComRate.Text & "e,7,1"
COMM.CommPort = ComPort.Text
COMM.PortOpen = True
Exit Sub
err:
MsgBox "操作错误!", vbOKOnly, "错误"
End Sub
Private Sub Combo2_Click()
ComObj.Clear
If Combo2.Text = "01" Then
Label7 = "Read Coil Status"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -