📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4515
ClientLeft = 60
ClientTop = 345
ClientWidth = 6525
LinkTopic = "Form1"
ScaleHeight = 4515
ScaleWidth = 6525
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command10
Caption = "Command10"
Height = 315
Left = 5190
TabIndex = 16
Top = 1770
Width = 1005
End
Begin VB.TextBox Text7
Height = 375
Left = 4080
TabIndex = 15
Text = "Text7"
Top = 1080
Width = 735
End
Begin VB.TextBox Text6
Height = 375
Left = 1560
TabIndex = 14
Text = "%01#WDD0101701019**"
Top = 3600
Width = 3735
End
Begin VB.CommandButton Command9
Caption = "修改仪器时间"
Height = 375
Left = 0
TabIndex = 13
Top = 3600
Width = 1455
End
Begin VB.TextBox Text5
Height = 375
Left = 1560
TabIndex = 12
Text = "%01#RDD"
Top = 3000
Width = 3735
End
Begin VB.CommandButton Command8
Caption = "读状态值"
Height = 375
Left = 0
TabIndex = 11
Top = 3000
Width = 1455
End
Begin VB.CommandButton Command7
Caption = "修改测量周期"
Height = 375
Left = 0
TabIndex = 10
Top = 2400
Width = 1455
End
Begin VB.TextBox Text4
Height = 375
Left = 1560
TabIndex = 9
Text = "%01#WDD0033100335**"
Top = 2400
Width = 3735
End
Begin VB.CommandButton Command6
Caption = "测量命令"
Height = 375
Left = 0
TabIndex = 8
Top = 1920
Width = 1455
End
Begin VB.TextBox Text3
Height = 375
Left = 0
TabIndex = 7
Top = 1440
Width = 3735
End
Begin VB.CommandButton Command5
Caption = "读仪器时间"
Height = 375
Left = 0
TabIndex = 6
Top = 960
Width = 1335
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 2760
Top = 120
End
Begin VB.TextBox Text2
Height = 375
Left = 5400
TabIndex = 5
Text = "9600,o,7,1"
Top = 1080
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "设置通讯"
Height = 375
Left = 5400
TabIndex = 4
Top = 720
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "关闭通讯"
Height = 375
Left = 3660
TabIndex = 3
Top = 330
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "打开通讯"
Height = 375
Left = 5400
TabIndex = 2
Top = 0
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 0
TabIndex = 1
Top = 480
Width = 3735
End
Begin VB.CommandButton Command1
Caption = "读COD"
Height = 375
Left = 0
TabIndex = 0
Top = 0
Width = 1335
End
Begin MSCommLib.MSComm MSComm1
Left = 5880
Top = 0
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
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()
MSComm1.Output = "%01#RDD0152101525**" & Chr(13)
Timer1.Tag = "COD"
Timer1.Enabled = True
End Sub
Private Sub Command10_Click()
Dim aa As Variant
aa = MSComm1.Input
Debug.Print MSComm1.Input
End Sub
Private Sub Command2_Click()
MSComm1.PortOpen = True
End Sub
Private Sub Command3_Click()
MSComm1.PortOpen = False
End Sub
Private Sub Command4_Click()
MSComm1.Settings = Text2.Text
End Sub
Private Sub Command5_Click()
MSComm1.Output = "%01#RDD9005490056**" & Chr(13)
Timer1.Tag = "TIME"
Timer1.Enabled = True
End Sub
Private Sub Command6_Click()
MSComm1.Output = "%01#WCSR06801**"
End Sub
Private Sub Command7_Click()
MSComm1.Output = Text4.Text
End Sub
Private Sub Command8_Click()
MSComm1.Output = Text5.Text
End Sub
Private Sub Command9_Click()
MSComm1.Output = Text6.Text
End Sub
Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
Debug.Print KeyAscii
End Sub
Private Sub Timer1_Timer()
Dim aa As Variant
Select Case Timer1.Tag
Case "COD"
Text1.Text = MSComm1.Input
Case "TIME"
Text3.Text = MSComm1.Input
End Select
Timer1.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -