发表于:2012/4/11 13:41:51
#0楼
各位大侠:
初学VB编程,串口通讯,以下程序看不懂:
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive ' 收到 RThreshold # of
xv: Dim hk As Variant
hk = MSComm1.Input
If Check2.Value = 1 Then '十六进制收数
If Check1.Value = 0 Then '帧处理
If hk(0) = &HFA Then '帧头
z_star = True
ovt = 0
End If
If hk(0) = &HFB Then '帧尾
z_star = False
in_data(ovt) = hk(0)
Call dispose_data '收到完整的一帧后调用数据处理了程序
End If
If z_star = True Then
in_data(ovt) = hk(0)
ovt = ovt + 1
End If
Else
Text1.Text = Text1.Text & Hex(hk(0)) & " "
End If
Else
Text1.Text = Text1.Text & hk
End If
If MSComm1.InBufferCount <> 0 Then
GoTo xv
End If
End Select
End Sub
上面的&HFA 和&HFB是什么意思啊,谢谢!
初学VB编程,串口通讯,以下程序看不懂:
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive ' 收到 RThreshold # of
xv: Dim hk As Variant
hk = MSComm1.Input
If Check2.Value = 1 Then '十六进制收数
If Check1.Value = 0 Then '帧处理
If hk(0) = &HFA Then '帧头
z_star = True
ovt = 0
End If
If hk(0) = &HFB Then '帧尾
z_star = False
in_data(ovt) = hk(0)
Call dispose_data '收到完整的一帧后调用数据处理了程序
End If
If z_star = True Then
in_data(ovt) = hk(0)
ovt = ovt + 1
End If
Else
Text1.Text = Text1.Text & Hex(hk(0)) & " "
End If
Else
Text1.Text = Text1.Text & hk
End If
If MSComm1.InBufferCount <> 0 Then
GoTo xv
End If
End Select
End Sub
上面的&HFA 和&HFB是什么意思啊,谢谢!