STM32 ISP串口烧录 VB源码(二)关键代码

Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function timeGetTime Lib "winmm.dll"() As Long
在程序最开始。

一、主要参数

Dim i As Long
Dim bin() As Byte
Dim BINLEN As Long
Dim Slen As Long
Dim str As String
Dim BAnk As Long          '总共有多少块
Dim ConStstus As Boolean  '连接状态
Dim Sendbuff() As Byte    '发送缓存
Dim Recvbuff(256) As Byte '接收缓存
Dim Binfile() As Byte     '文件缓存

二、一般操作代码

Private Sub CmdClear_Click() '清空操作
    Textdata = ""
End Sub
Private Sub Command2_Click()   '刷新端口
Dim G As Integer
Dim Index As Integer
if Index = 0 Then
   On Error Resume Next    '出现错误
   For G=1 To 9            '添加通讯选择
      MSComm1.CommPort = G
      MSComm1.PortOpen = true
      If MSComm1.PortOpen = true Then
          ComPortlist.AddItem "COM" & Trim$(G)
      End If
      MSComm1.PortOpen = False
    Next G
    ComPortlist.ListIndex = 0
End If
End Sub
Public Sub waittime(delay As Single)
Dim starttime As Single
starttime=Timer
Do Until (Timer-starttime)>delay
DoEvents
Loop
End Sub
Private Sub Command1_Click()  '退出操作
    If MSComm1.PortOpen=True Then MSComm1.PortOpen=False
    Unload Form1
    End
End Sub

三、核心程序

STM32 ISP串口烧录 VB源码(二)关键代码_第1张图片STM32 ISP串口烧录 VB源码(二)关键代码_第2张图片

STM32 ISP串口烧录 VB源码(二)关键代码_第3张图片

STM32 ISP串口烧录 VB源码(二)关键代码_第4张图片

STM32 ISP串口烧录 VB源码(二)关键代码_第5张图片

STM32 ISP串口烧录 VB源码(二)关键代码_第6张图片

你可能感兴趣的:(VB,VB开发,串口烧录)