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

📄 form1.frm

📁 files describe a example tranmister a txt by uart from host PC and select baud rate
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Nhom do an tot nghiep Neural Network - FPGA"
   ClientHeight    =   3150
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5805
   LinkTopic       =   "Form1"
   ScaleHeight     =   210
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   387
   StartUpPosition =   3  'Windows Default
   Begin MSCommLib.MSComm msComm 
      Left            =   420
      Top             =   1020
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin MSComDlg.CommonDialog dlgOpen 
      Left            =   120
      Top             =   120
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      Height          =   2295
      Left            =   60
      TabIndex        =   2
      Top             =   660
      Width           =   5595
      Begin VB.CommandButton cmdExit 
         Caption         =   "Exit"
         Height          =   315
         Left            =   4380
         TabIndex        =   6
         Top             =   1560
         Width           =   1095
      End
      Begin VB.ComboBox cboTranferBaud 
         Height          =   315
         ItemData        =   "Form1.frx":0000
         Left            =   300
         List            =   "Form1.frx":0002
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   1560
         Width           =   1575
      End
      Begin VB.CommandButton cmdSend 
         Caption         =   "Send"
         Height          =   315
         Left            =   2100
         TabIndex        =   4
         Top             =   1560
         Width           =   1095
      End
      Begin VB.CommandButton cmdCancel 
         Caption         =   "Cancel"
         Height          =   315
         Left            =   3240
         TabIndex        =   3
         Top             =   1560
         Width           =   1095
      End
   End
   Begin VB.TextBox txtFilePath 
      Enabled         =   0   'False
      Height          =   315
      Left            =   480
      TabIndex        =   1
      Top             =   240
      Width           =   3975
   End
   Begin VB.CommandButton cmdBrowser 
      Caption         =   "Browser"
      Height          =   315
      Left            =   4500
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdBrowser_Click()
    Dim FileName As String

    With Me.dlgOpen
        .DialogTitle = "Open File"
        .Filter = "All files (*.*)|*.*"
        .FilterIndex = 0
        .Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
        .CancelError = True
        
        .ShowOpen
        'If Error Then
        '     MsgBox Error & "Diaglog Cancelled", vbOKOnly
             
        '     Exit Sub
        'End If
        FileName = .FileName
        Me.txtFilePath.Text = FileName
    End With
    
    
End Sub

Private Sub cmdCancel_Click()
    Me.msComm.PortOpen = False
End Sub

Private Sub cmdExit_Click()
    Unload Me
    
End Sub

Private Sub cmdSend_Click()
    Dim freeNum As Integer
    If SettingComm = True Then
    
        freeNum = FreeFile
        Open Me.txtFilePath.Text For Input As #freeNum
        Do While Not EOF(freeNum)
            Line Input #freeNum, textline
            msComm.Output = textline & Chr(13)
        
        Loop
        Close #freeNum
        msComm.PortOpen = False
    End If
    
End Sub

Private Sub Form_Load()
    With Me.cboTranferBaud
        .Clear
        .AddItem ("110")
        .AddItem ("300")
        .AddItem ("600")
        .AddItem ("1200")
        .AddItem ("2400")
        .AddItem ("9600")
        .AddItem ("14400")
        .AddItem ("19200")
        .AddItem ("28800")
        .AddItem ("38400")
        .AddItem ("56000")
        .AddItem ("128000")
        .AddItem ("256000")
        .Text = "9600"
  
    End With
 
End Sub

Private Function SettingComm() As Boolean
    With msComm
        .CommPort = 1
        .Settings = Me.cboTranferBaud.Text & ",N,8,1"
        .InBufferSize = 1024
        .InputLen = 0
        .RThreshold = 1
        .SThreshold = 0
        .OutBufferSize = 512
        .InputMode = comInputModeBinary
        If .PortOpen = True Then
            MsgBox "Port is opened"
            SettingComm = False
            Exit Function
        Else
            .PortOpen = True
            SettingComm = True
        End If
        
        
    End With
    
End Function



⌨️ 快捷键说明

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