⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form5.frm

📁 模拟屏 实时控制 监测 报警 监测报告
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form5 
   Caption         =   "Form5"
   ClientHeight    =   4680
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5640
   LinkTopic       =   "Form5"
   MDIChild        =   -1  'True
   ScaleHeight     =   4680
   ScaleWidth      =   5640
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   2280
      TabIndex        =   2
      Text            =   "Text2"
      Top             =   2160
      Width           =   1215
   End
   Begin VB.Timer Timer1 
      Interval        =   100
      Left            =   1080
      Top             =   360
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   720
      TabIndex        =   1
      Top             =   2640
      Width           =   615
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   720
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   1440
      Width           =   1095
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   240
      Top             =   360
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Text2.Text = 0
End Sub

Private Sub Timer1_Timer()
Text1.Text = ""
Dim strincomm1 As String, strout As String
Text2.Text = Text2.Text + 1
'每100毫秒从串口接收一次数据
Dim IntPositionD As Integer '定义“0D”位置变量"
strout = ""

strincomm1 = strincomm1 + MSComm1.Input '得到串口1数据


IntPositionD = InStr(strincomm1, "eb90eb90eb90")
If IntPositionD > 0 Then '如果有
strout = strout + Left(strincomm1, IntPositionD) '取出左边的数据
strincomm1 = Right(strincomm1, Len(strincomm1) - IntPositionD) '取出右边的数据
End If

Text1.Text = strincomm1



End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -