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

📄 form1.frm

📁 16进制发送指令的源程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "发送16进制"
   ClientHeight    =   8325
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9135
   ControlBox      =   0   'False
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MouseIcon       =   "Form1.frx":08CA
   Picture         =   "Form1.frx":0D0C
   ScaleHeight     =   8325
   ScaleWidth      =   9135
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "全开"
      Height          =   375
      Left            =   2880
      TabIndex        =   24
      Top             =   6480
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00FFC0C0&
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "年+月+日+时+分+秒"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   0
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   0
      Locked          =   -1  'True
      TabIndex        =   22
      Top             =   7440
      Width           =   2655
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   20
      Top             =   7950
      Width           =   9135
      _ExtentX        =   16113
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   6
            TextSave        =   "2004-10-26"
            Key             =   "date"
            Object.ToolTipText     =   "日期"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            TextSave        =   "18:01"
            Key             =   "time"
            Object.ToolTipText     =   "时间"
         EndProperty
      EndProperty
   End
   Begin VB.ComboBox Combo6 
      Height          =   300
      Left            =   3840
      TabIndex        =   18
      Text            =   "1"
      Top             =   1560
      Width           =   975
   End
   Begin VB.ComboBox Combo5 
      Height          =   300
      Left            =   3840
      TabIndex        =   13
      Text            =   "8"
      Top             =   1200
      Width           =   975
   End
   Begin VB.ComboBox Combo4 
      Height          =   300
      Left            =   3840
      TabIndex        =   12
      Text            =   "无"
      Top             =   840
      Width           =   975
   End
   Begin VB.ComboBox Combo3 
      Height          =   300
      Left            =   3840
      TabIndex        =   11
      Text            =   "9600"
      Top             =   480
      Width           =   975
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      ItemData        =   "Form1.frx":16950
      Left            =   3840
      List            =   "Form1.frx":16957
      TabIndex        =   10
      Text            =   "COM1"
      Top             =   120
      Width           =   975
   End
   Begin VB.ComboBox Combo1 
      BackColor       =   &H00FFC0C0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      ItemData        =   "Form1.frx":16961
      Left            =   240
      List            =   "Form1.frx":16971
      TabIndex        =   9
      Text            =   "1"
      Top             =   6480
      Width           =   855
   End
   Begin VB.CommandButton Command7 
      BackColor       =   &H00FFC0C0&
      Caption         =   "遥控全部"
      Height          =   375
      Left            =   1320
      MaskColor       =   &H00FFC0C0&
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   6480
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      BackColor       =   &H00FFC0C0&
      Caption         =   "清空"
      Height          =   495
      Left            =   7800
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   6360
      Width           =   1095
   End
   Begin VB.CommandButton Command5 
      BackColor       =   &H00FFC0C0&
      Caption         =   "接受"
      Height          =   495
      Left            =   6360
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   5400
      Width           =   1095
   End
   Begin VB.CommandButton Command4 
      BackColor       =   &H00FFC0C0&
      Caption         =   "发送"
      Height          =   495
      Left            =   1200
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   5400
      Width           =   975
   End
   Begin VB.TextBox Text4 
      Height          =   2655
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   4
      Top             =   2280
      Width           =   8535
   End
   Begin VB.TextBox Text3 
      BeginProperty DataFormat 
         Type            =   0
         Format          =   "0"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   0
      EndProperty
      Height          =   495
      Left            =   2520
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   3
      Top             =   5400
      Width           =   3255
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H00FFC0C0&
      Caption         =   "结束"
      Height          =   495
      Left            =   7800
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   6840
      Width           =   1095
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   0
      Top             =   840
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      CommPort        =   5
      DTREnable       =   -1  'True
      InputLen        =   10
      RThreshold      =   10
      RTSEnable       =   -1  'True
      SThreshold      =   2
      InputMode       =   1
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "打开时间"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   2
      Left            =   120
      TabIndex        =   23
      Top             =   7080
      Width           =   855
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "遥控开门"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   1
      Left            =   240
      TabIndex        =   21
      Top             =   6120
      Width           =   855
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "停止位"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   5
      Left            =   3120
      TabIndex        =   19
      Top             =   1560
      Width           =   735
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "数据位"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   4
      Left            =   3120
      TabIndex        =   17
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "校验位"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   3
      Left            =   3120
      TabIndex        =   16
      Top             =   840
      Width           =   855
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "波特率"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   2
      Left            =   3120
      TabIndex        =   15
      Top             =   480
      Width           =   735
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "串口"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   1
      Left            =   3360
      TabIndex        =   14
      Top             =   120
      Width           =   495
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00FF0000&
      Index           =   1
      X1              =   0
      X2              =   9120
      Y1              =   6000
      Y2              =   6000
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00FF0000&
      Index           =   0
      X1              =   0
      X2              =   9120
      Y1              =   1920
      Y2              =   1920
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "接受字符(16进制)"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   0
      Left            =   360
      TabIndex        =   1
      Top             =   2040
      Width           =   1695
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "发送字符(16进制)"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   0
      Left            =   3360
      TabIndex        =   0
      Top             =   5040
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Dim OutByte() As Byte
Dim InByte() As Byte

Private send(6) As Byte

Dim com(3) As Integer

Private arrsend(5) As Byte

Private aend(6) As Byte



Private Sub Combo1_Click()    '遥控开门



If Combo1.Text = 1 Then                  '遥控1#门

  send(0) = &HFF

  send(1) = &HAA

  send(2) = &H3

  send(3) = &H25

  send(4) = &H1

  send(5) = &H0
  
  
  'MSComm1.Output = send()

ElseIf Combo1.Text = 2 Then                  '遥控2#门

  send(0) = &HFF

  send(1) = &HAA

  send(2) = &H3

  send(3) = &H25

  send(4) = &H2

  send(5) = &H0
  
  
ElseIf Combo1.Text = 3 Then                      '遥控3#门

  send(0) = &HFF

  send(1) = &HAA

⌨️ 快捷键说明

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