我现在在用VB编一个GSM模块与电脑通信的界面,可是我在用下面这段程序时,只有在cubf=mscomm1.input处设置中断后才能在mscomm1.input输入有值时执行蓝色字语句,但是当不设断点,全速运行时,mscomm1.input输入明明是有值得可是却执行了绿色字体的语句,查了很有的错不知道为什么,哪位高手可以指点一下吗?谢谢啦.
Public Sub initialize()
Dim cbuf$
MSComm1.Output = "at" & vbCr
For i = 0 To 100
Next i
cbuf = MSComm1.Input
If cbuf = "" Then
MsgBox "串口初使化失败,请选择正确的串口", vbOKOnly + vbInformation, "提示信息"
ElseIf InStr(cbuf, "OK") Then
MSComm1.Output = "at+csca=+8613800571500" & vbCr
For i = 0 To 100
Next i
If InStr(cbuf, "ERROR") Then
MsgBox "串口初使化失败,请确认是否装入SIM卡", vbOKOnly + vbInformation, "提示信息"
Else
MSComm1.Output = "at+cpms=" & Chr(34) & "mt" & Chr(34) & vbCr
For i = 0 To 100
Next i
MSComm1.Output = "at+cnmi=2,2,0,0,1" & vbCr
MSComm1.RThreshold = 1
End If
End If
End Sub