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

📄 上位机.frm

📁 实现计算机串口通信
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "通信"
   ClientHeight    =   3105
   ClientLeft      =   60
   ClientTop       =   435
   ClientWidth     =   5115
   LinkTopic       =   "Form1"
   ScaleHeight     =   3105
   ScaleWidth      =   5115
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "接收数据"
      Height          =   2055
      Left            =   2640
      TabIndex        =   4
      Top             =   360
      Width           =   1695
      Begin VB.TextBox txt_receive 
         Height          =   1695
         Left            =   120
         TabIndex        =   6
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "发送数据"
      Height          =   2055
      Left            =   720
      TabIndex        =   3
      Top             =   360
      Width           =   1695
      Begin VB.TextBox txt_send 
         Height          =   1695
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.CommandButton cmd_end 
      Caption         =   "结束"
      Height          =   375
      Left            =   3360
      TabIndex        =   2
      Top             =   2520
      Width           =   975
   End
   Begin VB.CommandButton cmd_recieve 
      Caption         =   "接收数据"
      Height          =   375
      Left            =   2040
      TabIndex        =   1
      Top             =   2520
      Width           =   975
   End
   Begin VB.CommandButton cmd_send 
      Caption         =   "发送数据"
      Height          =   375
      Left            =   720
      TabIndex        =   0
      Top             =   2520
      Width           =   975
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   0
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      InputLen        =   1
      BaudRate        =   2400
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_end_Click()
MSComm1.PortOpen = False
End
End Sub

Private Sub cmd_recieve_Click()
Dim buf$
buf = Trim(MSComm1.Input)
If Len(buf) = 0 Then
txt_receive.Text = "nothing"
Else
txt_receive.Text = buf
End If
End Sub

Private Sub cmd_send_Click()
MSComm1.Output = Trim(txt_send.Text)
End Sub

Private Sub Form_Load()
MSComm1.PortOpen = True

End Sub

⌨️ 快捷键说明

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