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

📄 form2.frm

📁 本系统可以演示pc机于单片机的通信
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form2 
   BackColor       =   &H00E0E0E0&
   Caption         =   "串行通行演示系统(字符方式)"
   ClientHeight    =   5400
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8100
   LinkTopic       =   "Form1"
   ScaleHeight     =   5400
   ScaleWidth      =   8100
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   375
      Left            =   3600
      TabIndex        =   6
      Top             =   4320
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "接收"
      Height          =   495
      Left            =   5760
      TabIndex        =   3
      Top             =   4200
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "发送"
      Height          =   495
      Left            =   1680
      TabIndex        =   2
      Top             =   4200
      Width           =   975
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   3720
      Top             =   120
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      InBufferSize    =   512
   End
   Begin VB.TextBox Text2 
      Height          =   2535
      Left            =   4560
      TabIndex        =   1
      Top             =   1080
      Width           =   2535
   End
   Begin VB.TextBox Text1 
      Height          =   2535
      Left            =   720
      TabIndex        =   0
      Top             =   1080
      Width           =   2655
   End
   Begin VB.Label Label2 
      Caption         =   "接受区:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5400
      TabIndex        =   5
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "发送区:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1320
      TabIndex        =   4
      Top             =   600
      Width           =   1095
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim outbyte
Dim inbyte
Private Sub Command1_Click()
Dim buf
buf = LTrim(Text1.Text)
MSComm1.Output = buf
End Sub

Private Sub Command2_Click()
inbyte = MSComm1.Input
Text2.Text = inbyte
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub

Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
  Case comEvSend
  Case comEvReceive
  inbyte = MSComm1.Input
End Select
  
End Sub

⌨️ 快捷键说明

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