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

📄 form1.frm

📁 VB与8051通信,内有VB和8051的源码
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4410
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6270
   LinkTopic       =   "Form1"
   ScaleHeight     =   4410
   ScaleWidth      =   6270
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox txtSend 
      Height          =   375
      Left            =   3840
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   2160
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "P10灯暗"
      Height          =   375
      Left            =   3600
      TabIndex        =   6
      Top             =   3000
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "P10灯亮"
      Height          =   375
      Left            =   1320
      TabIndex        =   5
      Top             =   3000
      Width           =   1215
   End
   Begin VB.TextBox txtReceive 
      Height          =   375
      Left            =   960
      ScrollBars      =   2  'Vertical
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   2160
      Width           =   1335
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   5160
      Top             =   3720
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      CommPort        =   2
      DTREnable       =   -1  'True
      RThreshold      =   1
      BaudRate        =   1200
   End
   Begin VB.Label Label1 
      Caption         =   "P32"
      Height          =   495
      Left            =   600
      TabIndex        =   3
      Top             =   1320
      Width           =   615
   End
   Begin VB.Label Label4 
      Caption         =   "P35"
      Height          =   495
      Left            =   5160
      TabIndex        =   2
      Top             =   1320
      Width           =   855
   End
   Begin VB.Label Label3 
      Caption         =   "P34"
      Height          =   375
      Left            =   3600
      TabIndex        =   1
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label2 
      Caption         =   "P33"
      Height          =   375
      Left            =   1920
      TabIndex        =   0
      Top             =   1320
      Width           =   735
   End
   Begin VB.Shape Shape4 
      FillStyle       =   0  'Solid
      Height          =   615
      Left            =   5040
      Shape           =   3  'Circle
      Top             =   480
      Width           =   735
   End
   Begin VB.Shape Shape3 
      FillStyle       =   0  'Solid
      Height          =   615
      Left            =   3525
      Shape           =   3  'Circle
      Top             =   480
      Width           =   735
   End
   Begin VB.Shape Shape2 
      FillStyle       =   0  'Solid
      Height          =   615
      Left            =   1995
      Shape           =   3  'Circle
      Top             =   480
      Width           =   735
   End
   Begin VB.Shape Shape1 
      FillStyle       =   0  'Solid
      Height          =   615
      Left            =   480
      Shape           =   3  'Circle
      Top             =   480
      Width           =   735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
                 Option Explicit


Private Sub Command1_Click()
MSComm1.Output = "0"
End Sub

Private Sub Command2_Click()
MSComm1.Output = "1"
End Sub

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

Private Sub MSComm1_OnComm()
Dim buf$
Select Case MSComm1.CommEvent
         Case comEvReceive
          buf = Trim(MSComm1.Input)
          
          txtReceive.Text = buf
          Select Case buf
                      Case "2"
                        Shape1.FillColor = RGB(255, 0, 0)
                      Case "3"
                        Shape2.FillColor = RGB(255, 0, 0)
                      Case "4"
                        Shape3.FillColor = RGB(255, 0, 0)
                      Case "5"
                        Shape4.FillColor = RGB(255, 0, 0)
                      Case "A"
                        Shape1.FillColor = RGB(0, 0, 0)
                      Case "B"
                        Shape2.FillColor = RGB(0, 0, 0)
                      Case "C"
                        Shape3.FillColor = RGB(0, 0, 0)
                      Case "D"
                        Shape4.FillColor = RGB(0, 0, 0)
           End Select
End Select


End Sub

⌨️ 快捷键说明

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