回 帖 发 新 帖 刷新版面

主题:VB串口通讯老卡死,如何解决?

VB串口通讯当串口数据意外中断时,电脑老卡死,有什么好的解决办法吗,谢谢!

Private Sub MSComm1_OnComm()

Select Case MSComm1.CommEvent '判断MSComm1 通信事件
Case comEvReceive '收到Rhtreshold 个字节后产生接收事件
'///////////////中断程序开始///////////////////////////////////////////////////////////////////////////////////
Static sz(900)  As String
Static a As Integer
Static b As Integer
Static i As Integer
Static Temp As String
Static Temp1 As Integer
Static add As Double
Static pi_data As Integer
pi_data = 140
 If MSComm1.CommEvent = comEvReceive Then Temp = MSComm1.Input
Temp1 = Asc(Temp)
If Temp = "$" Then
a = 0: MSComm1.InBufferCount = 0
Text4.Text = "$"
Else
a = a + 1
Text4.Text = Text4.Text + Temp
sz(a) = Temp
End If
If Temp1 <> 13 And Temp1 <> 32 And Temp1 <> 36 Then
If Temp1 > 57 Or Temp1 < 48 Then a = 0
End If
If a >= pi_data Then a = 0: Text3.Text = "": Text4.Text = ""
If a >= (pi_data - 1) And Temp = vbCr Then
Text3.Text = Text4.Text
b = 0
For i = 1 To (pi_data - 8)
b = b Xor Val(sz(i))
If Val(Mid(Text3.Text, (pi_data - 7), 5)) = b Then
Text5.Text = Mid(Text3.Text, 2, 6)
End If
Next i
End If

'///////////////中断程序结束///////////////////////////////////////////////////////////////////////////////////
End Select
End Sub


0

回复列表 (共1个回复)

沙发

在线博彩平台:www.pb258.com
在线博彩平台:www.jjxtech.com 
在线博彩平台:www.lcmty.com 
在线博彩平台:www.7macau.com
在线博彩平台:www.7macau.net
在线博彩平台:www.bp258.com
在线博彩平台:www.258bp.com
博狗:http://679.258bp.com
博狗:http://680.258bp.com
博狗:http://681.258bp.com
博狗:http://682.258bp.com
博狗:http://683.258bp.com
博狗:http://684.258bp.com
博狗:http://685.258bp.com
博狗:http://686.258bp.com
博狗:http://687.258bp.com
博狗:http://688.258bp.com
博狗:http://689.258bp.com
博狗:http://690.258bp.com
博狗:http://691.258bp.com
博狗:http://692.258bp.com
博狗:http://693.258bp.com
博狗合营:http://694.258bp.com
888真人:http://695.258bp.com
888真人:http://696.258bp.com
888真人:http://697.258bp.com
加百利:http://698.258bp.com
加百利:http://699.258bp.com 
必威:http://700.258bp.com
必威:http://701.258bp.com
必威:http://702.258bp.com
必威:http://703.258bp.com
必威:http://704.258bp.com
必威:http://705.258bp.com
必威:http://706.258bp.com
必威合营:http://707.258bp.com
新博:http://708.258bp.com
鸿运国际:http://709.258bp.com
鸿运国际:http://710.258bp.com
鸿运国际:http://711.258bp.com
新橙娱乐:http://712.258bp.com
新橙娱乐:http://713.258bp.com
新橙娱乐:http://714.258bp.com
新橙娱乐:http://715.258bp.com
新橙娱乐合营:http://716.258bp.com
乐虎:http://717.258bp.com
乐虎:http://718.258bp.com
乐虎:http://719.258bp.com
乐虎:http://720.258bp.com
乐虎:http://721.258bp.com
乐虎:http://722.258bp.com
亚虎:http://723.258bp.com
亚虎:http://724.258bp.com
亚虎:http://725.258bp.com
龙8国际娱乐:http://726.258bp.com
龙8国际娱乐:http://727.258bp.com
龙8国际娱乐:http://728.258bp.com
龙8国际娱乐:http://729.258bp.com
龙8国际娱乐:http://730.258bp.com
龙8国际娱乐:http://731.258bp.com
必博:http://2274.bbo233.com
必博:http://2274.bbo998.com

我来回复

您尚未登录,请登录后再回复。点此登录或注册