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

📄 main.frm

📁 VB代码
💻 FRM
📖 第 1 页 / 共 4 页
字号:
   Begin VB.Label LblFixInfo1 
      Caption         =   "系统信息"
      Height          =   492
      Left            =   240
      TabIndex        =   36
      Top             =   4560
      Width           =   852
   End
   Begin VB.Label lblSysInformationDisp 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "文件:"
      Height          =   612
      Left            =   1200
      TabIndex        =   35
      Top             =   4320
      Width           =   7092
   End
   Begin VB.Label lblDeviceName 
      Caption         =   "AT89SXX"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   6600
      TabIndex        =   34
      Top             =   5040
      Width           =   1212
   End
   Begin VB.Label lblPrintPortNo 
      Caption         =   "Com?"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   6000
      TabIndex        =   33
      Top             =   5040
      Width           =   612
   End
   Begin VB.Label lbl_DispCompleteRatio 
      Caption         =   "50%"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   13.8
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   324
      Left            =   5280
      TabIndex        =   32
      Top             =   5040
      Visible         =   0   'False
      Width           =   612
   End
   Begin VB.Label Lbl_ProgressPrompt 
      Caption         =   "完成进度"
      Height          =   252
      Left            =   240
      TabIndex        =   31
      Top             =   5040
      Visible         =   0   'False
      Width           =   852
   End
   Begin VB.Menu MNU_FILE 
      Caption         =   "文件(&F)"
      Begin VB.Menu MNU_File_FileOpen 
         Caption         =   "装入文件"
      End
      Begin VB.Menu MNU_File_FileSave 
         Caption         =   "保存文件"
      End
      Begin VB.Menu MNU_File_Separate1 
         Caption         =   "-"
      End
      Begin VB.Menu MNU_File_Exit 
         Caption         =   "退出(&Q)"
      End
   End
   Begin VB.Menu MNU_Edit 
      Caption         =   "编辑(&E)"
      Begin VB.Menu MNU_Edit_Edit 
         Caption         =   "编辑"
      End
      Begin VB.Menu MNU_Edit_FillBuff 
         Caption         =   "填充缓冲区"
      End
      Begin VB.Menu MNU_Edit_Find 
         Caption         =   "查找"
      End
   End
   Begin VB.Menu MNU_Device 
      Caption         =   "操作器件(&D)"
      Begin VB.Menu MNU_Device_DeviceSelect 
         Caption         =   "选择器件"
      End
      Begin VB.Menu MNU_ReadDeviceSignature 
         Caption         =   "读特征字"
      End
      Begin VB.Menu MNU_AutoExec 
         Caption         =   "自动操作"
      End
      Begin VB.Menu MNU_Device_Separate 
         Caption         =   "-"
      End
      Begin VB.Menu MNU_Device_Run 
         Caption         =   "运行操作"
      End
      Begin VB.Menu MNU_Device_Program 
         Caption         =   "编程"
      End
      Begin VB.Menu MNU_Device_Read 
         Caption         =   "读入"
      End
      Begin VB.Menu MNU_Device_Verify 
         Caption         =   "校验"
      End
      Begin VB.Menu MNU_Device_Lock 
         Caption         =   "加密"
      End
      Begin VB.Menu MNU_Devcie_Separate2 
         Caption         =   "-"
      End
      Begin VB.Menu MNU_Device_Erase 
         Caption         =   "擦除"
      End
      Begin VB.Menu MNU_Device_CheckBank 
         Caption         =   "查空"
      End
   End
   Begin VB.Menu MNU_Select 
      Caption         =   "选项(&S)"
      Begin VB.Menu MNU_Select_Setup 
         Caption         =   "设置"
         Begin VB.Menu MNU_Select_SetCommPort 
            Caption         =   "设置通讯端口"
         End
         Begin VB.Menu MNU_Select_SetAutoExecOption 
            Caption         =   "设置自动选项"
         End
         Begin VB.Menu MNU_Select_SetMusic 
            Caption         =   "设置音乐"
         End
         Begin VB.Menu MNU_Select_SetBackgroundPhoto 
            Caption         =   "设置背景"
         End
      End
      Begin VB.Menu MNU_Select_HugeNumber 
         Caption         =   "批量模式"
         Enabled         =   0   'False
      End
      Begin VB.Menu MNU_Select_TestOnLine 
         Caption         =   "联机测试"
      End
   End
   Begin VB.Menu MNU_Window 
      Caption         =   "窗口(&W)"
      Enabled         =   0   'False
   End
   Begin VB.Menu MNU_Help 
      Caption         =   "帮助(&H)"
      Begin VB.Menu MNU_Help_Help 
         Caption         =   "帮助"
      End
      Begin VB.Menu MNU_Help_Service 
         Caption         =   "联系我们"
      End
      Begin VB.Menu MNU_Help_SeparateBar 
         Caption         =   "-"
      End
      Begin VB.Menu MNU_Help_About 
         Caption         =   "关于编程器"
      End
   End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'针对当前选定的设备,进行硬件初始化和全局变量初始化
'建立符合当前待编程器件的硬件环境和软件环境.
Dim sCurrentDeviceSignatureString As String

Dim sCurrentRegisterSection As String
Dim sCurrentRegisterKey As String
Dim sCurrentRegisterSetting As String

Dim PGM_Register As New Registry
 

'输出编程系统的环境信息
Sub RefreshPGMSysInfo()
    Dim sOutputString As String
    
    sOutputString = Current_PGMSysInformation.PGMSysInfo_DispFileName & vbCrLf
    sOutputString = sOutputString & "器件类别:" & Current_PGMSysInformation.PGMSysInfo_DeviceGroupName & " " _
                    & "制造厂商:" & Current_PGMSysInformation.PGMSysInfo_ManufacturerName & "  " _
                    & "器件名称:" & Current_PGMSysInformation.PGMSysInfo_DeviceNameString & vbCrLf
                    
    sOutputString = sOutputString & "通讯端口号:Com" & CStr(Current_PGMSysInformation.PGMSysInfo_CommPortNumber) & "         "
    If (Current_PGMSysInformation.PGMSysInfo_ConvertBoardFlag) Then
        sOutputString = sOutputString & "是否需适配器:是"
    Else
        sOutputString = sOutputString & "是否需适配器:否"
    End If
    
    lblSysInformationDisp.Caption = sOutputString
End Sub


Sub InitSysForNewDevice()
    Dim bReturnValue As Boolean
    Dim lCount As Long
    Dim bFindDeviceFlag As Boolean
    
    Dim ucTemp As Byte
  '  bReturnValue = InitProgramDevice()
    
   ' Select Case (iCurrentDeviceID)
   '     Case c_AT29C256ID
            'lMaxCodeLength = &H8000
  '          lMaxCodeLength = 32768
  '          sCurrentDeviceSignatureString = c_AT29C256DeviceSignature
  '          lblDeviceName.Caption = c_AT29C256Name
  '      Case c_AT28C256ID
  '          lMaxCodeLength = &H8000
  '          sCurrentDeviceSignatureString = c_AT28C256DeviceSignature
  '          lblDeviceName.Caption = c_AT28C256Name
'
 '       Case c_ST27C256ID
 '           lMaxCodeLength = &H8000
 '           sCurrentDeviceSignatureString = c_ST27C256DeviceSignature
 '           lblDeviceName.Caption = c_ST27C256Name
 '       Case c_AT89C2051ID
 '           lMaxCodeLength = 2048
 '           sCurrentDeviceSignatureString = c_AT89C2051DeviceSignature
 '           lblDeviceName.Caption = c_AT89C2051Name
 '       Case Else
 '           MsgBox ("未知的器件类型.系统出错")
 '   End Select
    bFindDeviceFlag = False
    For lCount = 0 To c_MaxProgramDeviceNumber - 1 Step 1
        If (PGMDeviceLib(lCount).DeviceCompleteIDNumber = iCurrentDeviceID) Then
            lMaxCodeLength = PGMDeviceLib(lCount).DeviceMaxCodeLength
            sCurrentDeviceSignatureString = PGMDeviceLib(lCount).DeviceSignature
            
            lblDeviceName.Caption = PGMDeviceLib(lCount).DeviceNameString
                           
            ucCurrentDeviceGroup = PGMDeviceLib(lCount).DeviceGroup
            ucCurrentDeviceManufacturer = PGMDeviceLib(lCount).DeviceManufacturerID
            ucCurrentDeviceSeriesNumber = PGMDeviceLib(lCount).DeviceSeriesNumber
            
            ucTemp = ucCurrentDeviceGroup And &H3
            ucTemp = ucTemp * &H40      '取2位
            ucCurrentDeviceIDEnCode = ucTemp
            
            ucTemp = ucCurrentDeviceManufacturer And &H3
            ucTemp = ucTemp * &H10
            ucCurrentDeviceIDEnCode = ucCurrentDeviceIDEnCode + ucTemp
            
                        
            ucTemp = ucCurrentDeviceSeriesNumber And &HF
            ucCurrentDeviceIDEnCode = ucCurrentDeviceIDEnCode + ucTemp

            'Public iCurrentDeviceID As Integer

           ' ucCurrentDeviceGroup = pgmdevicelib(lcount).                '当前设备所在的类别 eprom cpu pld..
'Public ucCurrentDeviceManufacturer As Byte             '当前设备的制造厂商 如ST Atmel.Winbond
'Public ucCurrentDeviceSeriesNumber As Integer          '当前设备的顺序流水号
'Public Const c_DeviceGroup_MCU = 0
'Public Const c_DeviceGroup_MEM = 1
'Public Const c_DeviceGroup_PLD = 2
            Dim sTempString As String
            Select Case (ucCurrentDeviceGroup)
                Case c_DeviceGroup_MCU
                    sTempString = "单片机         "
                Case c_DeviceGroup_MEM
                    sTempString = "存储器         "
                Case c_DeviceGroup_PLD
                    sTempString = "可编程逻辑器件 "
            End Select
            
            Current_PGMSysInformation.PGMSysInfo_DeviceGroupName = sTempString
            Current_PGMSysInformation.PGMSysInfo_ManufacturerName = PGMDeviceLib(lCount).DeviceManufacturerName
            Current_PGMSysInformation.PGMSysInfo_DeviceNameString = PGMDeviceLib(lCount).DeviceNameString
            
            
            Call FrmMain.RefreshPGMSysInfo
            
            bFindDeviceFlag = True
            Exit For
        End If
    Next lCount
    
    If (bFindDeviceFlag = False) Then
           MsgBox ("未知的器件类型.系统出错")
    End If
    
    FrmMain.LblOperationInfoDisp.Caption = "打开编程数据文件,起始6单元内容为:" _
    & CStr_Hex(ucDataBuff(0)) & " " & CStr_Hex(ucDataBuff(1)) & " " & CStr_Hex(ucDataBuff(2)) _
    & " " & CStr_Hex(ucDataBuff(3)) & " " & CStr_Hex(ucDataBuff(4)) & " " & CStr_Hex(ucDataBuff(5))
    
'    Call ConvertDataBuffContentToFormatString
   TxtDataBuffDispBox.Text = ConvertDataBuffContentToFormatString()
   
   bSendCmd_SelectProgramDeviceIDNuberFlag = False
   bReadDeviceSignatureFlag = False
   lblDeviceName.ForeColor = vbYellow

End Sub

Private Sub Cmd_AppExit_Click()
    Call MNU_File_Exit_Click
End Sub

Private Sub Cmd_BufferEdit_Click()
    Call MNU_Edit_Edit_Click
End Sub

Private Sub Cmd_AutoExec_Click()
    Cmd_AutoExec.Enabled = False
    Call MNU_AutoExec_Click
    Cmd_AutoExec.Enabled = True
End Sub

Private Sub Cmd_DeviceErase_Click()
    Cmd_DeviceErase.Enabled = False
    Call MNU_Device_Erase_Click
    Cmd_DeviceErase.Enabled = True
End Sub

Private Sub Cmd_DeviceLock_Click()
    Cmd_DeviceLock.Enabled = False
    Call MNU_Device_Lock_Click
    Cmd_DeviceLock.Enabled = True
End Sub

Private Sub Cmd_DeviceProgram_Click()
    Cmd_DeviceProgram.Enabled = False
    Call MNU_Device_Program_Click
    Cmd_DeviceProgram.Enabled = True

End Sub

Private Sub Cmd_DeviceRead_Click()
    Cmd_DeviceRead.Enabled = False
    Call MNU_Device_Read_Click
    Cmd_DeviceRead.Enabled = True
End Sub

Private Sub Cmd_DeviceRun_Click()
    'Cmd_DeviceRun
    Call MNU_Device_Run_Click
End Sub

⌨️ 快捷键说明

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