📄 jimian.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5265
ClientLeft = 60
ClientTop = 450
ClientWidth = 8430
LinkTopic = "Form1"
ScaleHeight = 5265
ScaleWidth = 8430
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
Height = 735
Left = 7080
TabIndex = 7
Top = 2280
Width = 975
End
Begin VB.CommandButton Command4
Caption = "卧室"
Height = 735
Left = 7200
TabIndex = 6
Top = 3120
Width = 855
End
Begin VB.TextBox Text3
Height = 735
Left = 5880
TabIndex = 5
Top = 2280
Width = 975
End
Begin VB.CommandButton Command3
Caption = "客厅"
Height = 735
Left = 5880
TabIndex = 4
Top = 3120
Width = 975
End
Begin VB.CommandButton Command2
Caption = "接收数据"
Height = 735
Left = 3240
TabIndex = 3
Top = 2400
Width = 1455
End
Begin VB.TextBox Text2
Height = 975
Left = 1200
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 1320
Width = 3495
End
Begin VB.Timer Timer1
Interval = 1000
Left = 600
Top = 0
End
Begin VB.TextBox Text1
Height = 615
Left = 1200
TabIndex = 1
Text = "1"
Top = 0
Width = 3495
End
Begin VB.CommandButton Command1
Caption = "发送数据"
Height = 615
Left = 3360
TabIndex = 0
Top = 720
Width = 1335
End
Begin MSCommLib.MSComm MSComm1
Left = 0
Top = 0
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
InputLen = 8
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i1 As Long
Dim j1 As Long
Private Sub Command1_Click()
Dim i As Long
MSComm1.RTSEnable = False
Do
i = i + 1
Loop Until i > 500000
MSComm1.Output = Text1.Text
i = 0
Do
i = i + 1
Loop Until i > 500000
MSComm1.RTSEnable = True
End Sub
Private Sub Command2_Click()
MSComm1.RTSEnable = True
End Sub
Private Sub Command3_Click()
Dim i1 As Long
Dim j1 As Long
MSComm1.RTSEnable = False
j1 = 1
Do
i1 = i1 + 1
Loop Until i1 > 500000
MSComm1.Output = j1
i1 = 0
Do
i = i1 + 1
Loop Until i1 > 500000
MSComm1.RTSEnable = True
End Sub
Private Sub Command4_Click()
Dim i2 As Long
Dim j2 As Long
MSComm1.RTSEnable = False
j2 = 2
Do
i2 = i2 + 1
Loop Until i > 500000
MSComm1.Output = j2
i2 = 0
Do
i2 = i2 + 1
Loop Until i2 > 500000
MSComm1.RTSEnable = True
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 0 '用input可读出整个接受缓冲区中的内容
MSComm1.RThreshold = 1 '每当接收到一个数据时就引发OnComm事件,即使MSComm1.CommEvent = comEvReceive
MSComm1.PortOpen = True
MSComm1.RTSEnable = False
End Sub
Private Sub MSComm1_OnComm()
If (MSComm1.CommEvent = comEvReceive) Then
Text2.Text = Asc(MSComm1.Input)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -