📄 rs485.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "RS485测试程序"
ClientHeight = 3585
ClientLeft = 60
ClientTop = 345
ClientWidth = 5475
LinkTopic = "Form1"
ScaleHeight = 3585
ScaleWidth = 5475
StartUpPosition = 3 '窗口缺省
Begin MSCommLib.MSComm MSComm1
Left = 4200
Top = 0
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = 0 'False
ParityReplace = 48
RThreshold = 1
BaudRate = 1200
End
Begin VB.CommandButton Command2
Caption = "停止并清除"
Height = 495
Left = 2760
TabIndex = 2
Top = 2880
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "开始接收"
Height = 495
Left = 240
TabIndex = 1
Top = 2880
Width = 2415
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2355
Left = 240
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 480
Width = 4935
End
Begin VB.Label Label1
Caption = "RS485钡Μ(COM 1)"
BeginProperty Font
Name = "Tahoma"
Size = 11.25
Charset = 136
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1920
TabIndex = 3
Top = 120
Width = 2295
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True '
End If
End Sub
Private Sub Command2_Click() '
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
Text2.Text = ""
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
End
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent '
Case comEvReceive '
Text2.Text = Text2.Text & CStr(MSComm1.Input)
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -