📄 plc-pc.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2490
ClientLeft = 45
ClientTop = 345
ClientWidth = 3750
LinkTopic = "Form1"
ScaleHeight = 8595
ScaleWidth = 11880
StartUpPosition = 3 '窗口缺省
Begin MSCommLib.MSComm MSComm1
Left = 360
Top = 2280
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
End
Begin VB.Timer Timer1
Left = 360
Top = 1440
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 372
Left = 5520
TabIndex = 4
Top = 3480
Width = 1932
End
Begin VB.CommandButton Command2
Caption = "清除文本信息"
Height = 372
Left = 3360
TabIndex = 3
Top = 3480
Width = 1932
End
Begin VB.CommandButton Command1
Caption = "接收开始"
Height = 372
Left = 1320
TabIndex = 2
Top = 3480
Width = 1812
End
Begin VB.TextBox Text1
Height = 1932
Left = 1320
TabIndex = 1
Text = "Text1"
Top = 1200
Width = 6132
End
Begin VB.Label Label1
Caption = "微机接收到PLC的信息"
Height = 252
Left = 3240
TabIndex = 0
Top = 840
Width = 1812
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a$
Private Sub Form_Load()
Form1.WindowState = 2
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
Else
End If
Timer1.Interval = 1000
Timer1.Enabled = False
Text1.Text = ""
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
MSComm1.PortOpen = True
Do While MSComm1.InBufferCount < 6
Loop
a$ = MSComm1.Input
Text1.Text = Text1.Text + a$
MSComm1.PortOpen = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -