📄 main.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMAIN
Caption = "panther"
ClientHeight = 7575
ClientLeft = 60
ClientTop = 750
ClientWidth = 8370
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "Main.frx":0000
LinkTopic = "Form1"
ScaleHeight = 7575
ScaleWidth = 8370
StartUpPosition = 2 'CenterScreen
Begin VB.TextBox MCUdata
ForeColor = &H00800080&
Height = 6330
Left = 4200
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 870
Width = 4095
End
Begin VB.TextBox LoadData
ForeColor = &H00800080&
Height = 6330
Left = 60
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 870
Width = 4095
End
Begin MSComDlg.CommonDialog Dialog
Left = 420
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.StatusBar StatusBar
Align = 2 'Align Bottom
Height = 285
Left = 0
TabIndex = 0
Top = 7290
Width = 8370
_ExtentX = 14764
_ExtentY = 503
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 8113
MinWidth = 8113
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
AutoSize = 2
Object.Width = 2117
MinWidth = 2117
TextSave = "5/2/2009"
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
AutoSize = 2
Object.Width = 1773
MinWidth = 1764
TextSave = "9:13 AM"
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComctlLib.ProgressBar PrgsBar
Height = 375
Left = 60
TabIndex = 3
Top = 420
Width = 8235
_ExtentX = 14526
_ExtentY = 661
_Version = 393216
Appearance = 1
End
Begin VB.Label lPerinfo
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Courier New"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C000C0&
Height = 375
Left = 7530
TabIndex = 5
Top = 30
Width = 735
End
Begin VB.Label LbInfo
BeginProperty Font
Name = "Courier New"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C000C0&
Height = 375
Left = 60
TabIndex = 4
Top = 0
Width = 8235
End
Begin VB.Menu mnuFile
Caption = "File"
Begin VB.Menu mnuOpen
Caption = "Open"
End
Begin VB.Menu mnuSave
Caption = "Save binary file"
End
Begin VB.Menu mnuSaveReadout
Caption = "Save readout"
End
End
Begin VB.Menu mnuProgram
Caption = "Program"
End
Begin VB.Menu mnuRead
Caption = "Read"
End
Begin VB.Menu mnuErase
Caption = "Erase"
End
Begin VB.Menu mnuBlankTest
Caption = "BlankTest"
End
Begin VB.Menu mnuVerify
Caption = "Verify"
End
Begin VB.Menu mnuChipID
Caption = "ChipID"
End
Begin VB.Menu mnuSettings
Caption = "Settings"
End
Begin VB.Menu mnuHelp
Caption = "Help"
End
End
Attribute VB_Name = "frmMAIN"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
MakeOnBits
get_ini
If Len(fpath) < 3 Then
fpath = App.Path
End If
HexF = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
set_ini
End
End Sub
Public Sub MSG(ByVal str As String)
StatusBar.Panels.Item(1).Text = str
End Sub
Public Sub MSG2(ByVal str As String)
StatusBar.Panels.Item(2).Text = str
End Sub
Private Sub mnuOpen_Click()
MY = 0
Dim filepath
Dim strpath As String
Dim strfolder As String
Dim strname As String
With Dialog
.DialogTitle = "Open"
.CancelError = False
.InitDir = fpath
.Filter = "Intel HEX file (*.hex) |*.hex|Binary file (*.bin) |*.bin"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
filepath = .FileName
.FileName = ""
End With
ParseHEX.ClearGlobals
If InStr(1, UCase(Right(filepath, 4)), ".HEX", vbBinaryCompare) > 0 Then
If FileData.StringReadData(filepath) = False Then
MsgBox "Bad file", vbInformation, "ccc"
Exit Sub
End If
If ParseHEX.ParseIntelHexFile = False Then
ParseHEX.ClearGlobals
Exit Sub
End If
ParseHEX.CreateBinData
ParseHEX.DisplayLoadData
HexF = True
ElseIf InStr(1, UCase(Right(filepath, 4)), ".BIN", vbTextCompare) > 0 Then
If FileData.BinaryReadData(filepath) = False Then
MsgBox "Bad file", vbInformation, "ccc"
ParseHEX.ClearGlobals
Exit Sub
End If
ParseHEX.DisplayLoadData
HexF = False
End If
fpath = filepath
MSG fpath
MSG2 Blen + 1 & " bytes"
MsgBox MY
Exit Sub
greska:
LbInfo.Caption = "Fajl nije ucitan"
MsgBox Err.Number & Err.Description
End Sub
Private Sub mnuProgram_Click()
Dim i As Integer
Dim start As Long
If Blen = 0 Then
MsgBox "No file opened", vbInformation, "Panther"
Exit Sub
End If
frmMAIN.Enabled = False
LbInfo.Caption = "Programiranje u toku ..."
SetProgressMax (Blen)
start = GetTickCount
AT89C2051.InitDevice
AT89C2051.InitWriteCodeByte
For i = 0 To Blen
AT89C2051.WriteCodeByte (bytesArr(Blen))
AT89C2051.IncrementAdress
UpdateProgress (i)
Next i
LbInfo.Caption = "Programiranje zavrseno"
PrgsBar.Value = 0
lPerinfo.Caption = ""
frmMAIN.Enabled = True
End Sub
Private Sub mnuRead_Click()
Dim i As Integer
Dim start As Long
start = GetTickCount
AT89C2051.InitDevice
AT89C2051.InitReadCodeByte
For i = 1 To 2000
AT89C2051.ReadCodeByte
AT89C2051.IncrementAdress
Next i
MsgBox GetTickCount - start
End Sub
Private Sub mnuSave_Click()
On Error GoTo greska
Dim strpath As String
Dim strfolder As String
Dim strname As String
strpath = Mid(fpath, 1, Len(fpath) - 4) & ".BIN"
With Dialog
.DialogTitle = "Save binary file"
.CancelError = True
'ToDo: set the flags and attributes of the common dialog control
.InitDir = strpath
.FileName = strpath
.Filter = "binary file (*.BIN)|*.BIN"
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
strpath = .FileName
End With
If Blen = 0 Then
MsgBox "No data to save", vbInformation, "ccc"
Else
FileData.ClearFile (strpath)
FileData.BinarySaveData Mid(strpath, 1, Len(strpath) - 4), "BIN"
End If
Exit Sub
greska:
If Err.Number = 32755 Then Exit Sub
MsgBox Err.Number & Err.Description
End Sub
Private Sub mnuSaveReadout_Click()
On Error GoTo greska
Dim strpath As String
Dim strfolder As String
Dim strname As String
strfolder = Ini.ParseFolder(fpath)
strpath = strfolder & "readout.BIN"
With Dialog
.DialogTitle = "Save MCU readout"
.CancelError = True
'ToDo: set the flags and attributes of the common dialog control
.InitDir = strpath
.FileName = strpath
.Filter = "binary file (*.BIN)|*.BIN"
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
strpath = .FileName
End With
If MCUlen = 0 Then
MsgBox "No data to save", vbInformation, "ccc"
Else
FileData.ClearFile (strpath)
FileData.BinarySaveDataR Mid(strpath, 1, Len(strpath) - 4), "BIN"
End If
Exit Sub
greska:
If Err.Number = 32755 Then Exit Sub
MsgBox Err.Number & Err.Description
End Sub
Public Sub SetProgressMax(ByVal Max As Integer)
PrgsBar.Max = Max + 1
End Sub
Public Sub UpdateProgress(ByVal num As Integer)
PrgsBar.Value = num + 1
If PrgsBar.Value = 0 Then
lPerinfo.Caption = "0%"
Else
lPerinfo.Caption = CStr(CInt(100 * PrgsBar.Value / PrgsBar.Max)) & "%"
End If
DoEvents
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -