?? main.frm
字號:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Main
BorderStyle = 3 'Fixed Dialog
Caption = "串口編程調(diào)試精靈"
ClientHeight = 5865
ClientLeft = 4515
ClientTop = 2820
ClientWidth = 7860
BeginProperty Font
Name = "宋體"
Size = 8.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "frmCommWizard"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5865
ScaleWidth = 7860
Begin VB.TextBox txtSend
Height = 375
Left = 5520
TabIndex = 13
Top = 5160
Width = 1695
End
Begin VB.ComboBox combo
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 5520
TabIndex = 11
Top = 4560
Width = 1695
End
Begin VB.CommandButton clear
Caption = "清除"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4560
TabIndex = 10
Top = 4560
Width = 975
End
Begin VB.CommandButton Setting
Caption = "設(shè)置參數(shù)"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3480
TabIndex = 9
Top = 4560
Width = 1095
End
Begin VB.CommandButton Receive
Caption = "開始接收"
BeginProperty Font
Name = "宋體"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2400
TabIndex = 8
Top = 4560
Width = 1095
End
Begin VB.CommandButton send2
Caption = "手動發(fā)送"
BeginProperty Font
Name = "宋體"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 7
Top = 4560
Width = 975
End
Begin VB.CommandButton send
Caption = "自動發(fā)送"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 6
Top = 4560
Width = 975
End
Begin VB.Timer ctrTimer
Left = 4560
Top = 120
End
Begin VB.Frame Frame2
Caption = "接收回顯"
BeginProperty Font
Name = "宋體"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3735
Left = 480
TabIndex = 0
Top = 600
Width = 6735
Begin VB.CheckBox chkAddress48
Caption = "4/8位地址"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5400
TabIndex = 5
Top = 2520
Width = 1215
End
Begin VB.CheckBox chkAddress
Caption = "地址"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5400
TabIndex = 4
Top = 1800
Width = 1215
End
Begin VB.CheckBox chkAscii
Caption = "ASCII碼"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5400
TabIndex = 3
Top = 480
Width = 1215
End
Begin VB.CheckBox chkHex
Caption = "十六進(jìn)制碼"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 5400
TabIndex = 2
Top = 1080
Width = 1215
End
Begin VB.TextBox txtReceive
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3240
Left = 200
MultiLine = -1 'True
TabIndex = 1
Top = 300
Width = 4860
End
End
Begin MSCommLib.MSComm ctrMSComm
Left = 6720
Top = 0
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
InputLen = 8
End
Begin VB.Label Label1
Caption = "發(fā)送信息"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4680
TabIndex = 12
Top = 5280
Width = 855
End
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**********************************
'字符表示的十六進(jìn)制數(shù)轉(zhuǎn)化為相應(yīng)的整數(shù)
'錯誤則返回 -1
'**********************************
Function ConvertHexChr(str As String) As Integer
Dim test As Integer
test = Asc(str)
If test >= Asc("0") And test <= Asc("9") Then
test = test - Asc("0")
ElseIf test >= Asc("a") And test <= Asc("f") Then
test = test - Asc("a") + 10
ElseIf test >= Asc("A") And test <= Asc("F") Then
test = test - Asc("A") + 10
Else
test = -1 '出錯信息
End If
ConvertHexChr = test
End Function
'**********************************
'字符串表示的十六進(jìn)制數(shù)據(jù)轉(zhuǎn)化為相應(yīng)的字節(jié)串
'返回轉(zhuǎn)化后的字節(jié)數(shù)
'**********************************
Function strHexToByteArray(strText As String, bytByte() As Byte) As Integer
Dim HexData As Integer '十六進(jìn)制(二進(jìn)制)數(shù)據(jù)字節(jié)對應(yīng)值
Dim hstr As String * 1 '高位字符
Dim lstr As String * 1 '低位字符
Dim HighHexData As Integer '高位數(shù)值
Dim LowHexData As Integer '低位數(shù)值
Dim HexDataLen As Integer '字節(jié)數(shù)
Dim StringLen As Integer '字符串長度
Dim Account As Integer '計數(shù)
strTestn = "" '設(shè)初值
HexDataLen = 0
strHexToByteArray = 0
StringLen = Len(strText)
Account = StringLen \ 2
ReDim bytByte(Account)
For n = 1 To StringLen
Do '清除空格
hstr = Mid(strText, n, 1)
n = n + 1
If (n - 1) > StringLen Then
HexDataLen = HexDataLen - 1
Exit For
End If
Loop While hstr = " "
Do
lstr = Mid(strText, n, 1)
n = n + 1
If (n - 1) > StringLen Then
HexDataLen = HexDataLen - 1
Exit For
End If
Loop While lstr = " "
n = n - 1
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -