各位大侠帮忙:求串口调试源码,最好是C或VB的

来源:百度知道 编辑:UC知道 时间:2024/05/29 12:17:17

是用VB调试精灵的源代码改过来的,以16进制方式显示发送:
Option Explicit
Dim intTime As Integer
Private strSendText As String '发送文本数据
Private bytSendByte() As Byte '发送二进制数据
Private blnReceiveFlag As Boolean
Private blnAutoSendFlag As Boolean
Private intPort As Integer
Private strSet As String
Private intReceiveLen As Integer
Private bytReceiveByte() As Byte
Private strAscii As String '设置初值
Private strHex As String
Private intHexWidth As Integer
Private intLine As Integer
Private m As Integer
Private strAddress As String
'字符表示的十六进制数转化为相应的整数,错误则返回 -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