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

📄 boseexport.frm

📁 这是一个vb编写的利用串口进行通信的程序
💻 FRM
字号:
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 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "ADAU1701 VIRTUAL BASS V1.0"
   ClientHeight    =   3450
   ClientLeft      =   3540
   ClientTop       =   2955
   ClientWidth     =   7230
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3450
   ScaleWidth      =   7230
   WhatsThisHelp   =   -1  'True
   Begin VB.Frame Frame2 
      Caption         =   "INTENSITY"
      Height          =   1335
      Left            =   1680
      TabIndex        =   7
      Top             =   1320
      Width           =   5175
      Begin VB.HScrollBar HScroll1 
         Height          =   615
         Left            =   480
         Max             =   19
         TabIndex        =   9
         Top             =   360
         Width           =   3735
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000004&
         Height          =   615
         Left            =   4320
         TabIndex        =   8
         Text            =   "00"
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.PictureBox Picture1 
      Height          =   795
      Left            =   3600
      Picture         =   "BoseExport.frx":0000
      ScaleHeight     =   735
      ScaleWidth      =   3075
      TabIndex        =   6
      Top             =   240
      Width           =   3135
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   495
      Left            =   0
      TabIndex        =   5
      Top             =   2955
      Width           =   7230
      _ExtentX        =   12753
      _ExtentY        =   873
      Style           =   1
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   2822
            MinWidth        =   2822
            Text            =   "Status: Off"
            TextSave        =   "Status: Off"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   10583
            MinWidth        =   10583
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton Bootload 
      Caption         =   "BOOTLOAD"
      Height          =   325
      Left            =   1800
      TabIndex        =   4
      Top             =   480
      Width           =   1575
   End
   Begin VB.Frame Frame3 
      Caption         =   "BOOT LOAD"
      Height          =   975
      Left            =   1680
      TabIndex        =   3
      Top             =   240
      Width           =   5175
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   6600
      Top             =   2520
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      RThreshold      =   1
   End
   Begin VB.Frame Frame1 
      Caption         =   "COM Options"
      Height          =   2415
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1215
      Begin VB.ComboBox COMbps 
         Height          =   315
         ItemData        =   "BoseExport.frx":77CA
         Left            =   120
         List            =   "BoseExport.frx":77DD
         Style           =   2  'Dropdown List
         TabIndex        =   2
         TabStop         =   0   'False
         Top             =   1680
         Width           =   975
      End
      Begin VB.ComboBox COMnum 
         Height          =   315
         ItemData        =   "BoseExport.frx":7803
         Left            =   120
         List            =   "BoseExport.frx":7813
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "BAUD RATE:"
         Height          =   375
         Left            =   120
         TabIndex        =   11
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "PORT:"
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   360
         Width           =   975
      End
   End
   Begin VB.Menu About 
      Caption         =   "About"
      Visible         =   0   'False
      Begin VB.Menu help 
         Caption         =   "Programmed by Wayman@GPESZ 2005-1-17"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'PC Com port transmiter for Virtual Bass
'programmed by GraneGuang@GPE 2007-08-24

Option Explicit
Dim temp1
Public FileName As String
Public FileNum As Integer
Public StartRecord As Boolean
Public ComSelectOk As Boolean
Public PowerIs70V As Integer
Private ThisControl As Control
Dim CntOfInputSN  As Integer
Dim Checksum As Integer
Dim buf As Variant
Dim FrashEndTxData(0 To 6) As Byte
Dim ProcessType As Integer
Dim SerialNumberRefBuf(0 To 24) As Byte
Dim ClockAuditRefBuf(0 To 16) As Byte
Dim CommRxCnt As Long
Private Declare Function Beep Lib "kernel32.dll" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Dim LengthOfBootloadFile   As Integer


Private Sub Bootload_Click()
Dim FileReadingCnt As Long
Dim data(0 To 9420) As Byte          '定义一个byte型数组
Dim SPICtrWord(0 To 2) As Byte

    Open "F:\work space\vb\EXPORT\2.BIN" For Binary As #1       '打开文件
    SPICtrWord(0) = &H0
    SPICtrWord(1) = &H0
    SPICtrWord(2) = &HE
    Get #1, 1, data()                'Data(0) to Data(9420)
    
    StatusBar1.SimpleText = "Status: Bootloading..."
    MSComm1.Output = SPICtrWord
    MSComm1.Output = data
    MsgBox ("SPI Bootload! Success!")
    StatusBar1.SimpleText = "Adjusting "
    Close #1

End Sub

Private Sub Form_Load()
    '波特率初始化
    On Error GoTo ErrHandler
    MSComm1.Settings = "9600,N,8,1"
    MSComm1.PortOpen = True
    
    COMnum.ListIndex = 0
    COMbps.ListIndex = 0
    
    Exit Sub
ErrHandler:
    temp1 = MsgBox("COM port is in use! Or it's not exist!", vbCritical, "BoseExport")
    StatusBar1.SimpleText = "Status: Off"
End Sub



Private Sub COMnum_Click()                              'COM端口选择
    Dim I As Integer
    
    On Error GoTo ErrHandler
    If MSComm1.CommPort <> COMnum.ListIndex + 1 Then
        If MSComm1.PortOpen = False Then
            MSComm1.CommPort = COMnum.ListIndex + 1
            MSComm1.PortOpen = True
        Else
            MSComm1.PortOpen = False
            MSComm1.CommPort = COMnum.ListIndex + 1
            MSComm1.PortOpen = True
        End If
    End If
    ComSelectOk = True
    Exit Sub
ErrHandler:
    ComSelectOk = False
    temp1 = MsgBox("COM port is in use! Or it's not exist!", vbCritical, "Charger Test Data Recorder")
End Sub


Private Sub COMbps_CLICK()                          'COM口波特率选择
    Dim ComPortSettings As String
    Dim CurrentBps As String
    Dim I As Integer

    ComPortSettings = MSComm1.Settings
    CurrentBps = Left$(ComPortSettings, InStr(ComPortSettings, ",") - 1)

    On Error GoTo ErrHandler
    If CurrentBps <> COMbps.Text Then
        If MSComm1.PortOpen = False Then
            ComPortSettings = COMbps.Text & Right$(ComPortSettings, 6)
            MSComm1.Settings = ComPortSettings
            MSComm1.PortOpen = True
        Else
            MSComm1.PortOpen = False
            ComPortSettings = COMbps.Text & Right$(ComPortSettings, 6)
            MSComm1.Settings = ComPortSettings
            MSComm1.PortOpen = True
        End If
    End If
    Exit Sub
    
ErrHandler:
    temp1 = MsgBox("COM port is in use! Or it's not exist!", vbCritical, "Charger Test Data Recorder")
End Sub

Private Sub HScroll1_change()
Dim SPICtrWord(0 To 4) As Byte

    SPICtrWord(0) = &H0
    SPICtrWord(1) = &H0
    SPICtrWord(2) = &HE
    SPICtrWord(3) = &H0
    SPICtrWord(4) = HScroll1.Value
    MSComm1.Output = SPICtrWord
    Text1.Text = Chr$(48 + HScroll1.Value \ 10) + Chr$(48 + (HScroll1.Value Mod 10))
End Sub


⌨️ 快捷键说明

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