不触发MSComm1_OnComm
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGR=2" & vbCrLf
Sleep 500
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 11
If MSComm1.PortOpen = False Then
MSComm1.Settings = "115200,n,8,1"
MSComm1.PortOpen = True
End If
MSComm1.InputMode = 0
MSComm1.OutBufferCount = 0
MSComm1.InBufferCount = 0
MSComm1.InputLen = 1
MSComm1.RThreshold = 1
End Sub
Private Sub MSComm1_OnComm()
MsgBox ("MSComm1.CommEvent " & MSComm1.CommEvent)
End Sub
端口MSComm1.CommPort = 11
在超级终端下面正常接收,在VB里就没有接收任何信息,不触发MSComm1_OnComm
如果把端口换成1,MSComm1.CommPort = 1 '用另一个设备就
在超级终端下面正常接收,在VB里也可以正常触发MSComm1_OnComm
不同设备对MSComm1支持不一样吗?
但在超级终端里都是正常的?
还需要设置什么啊?
[解决办法]
这是一个VB编制的串口调试器,你可以借鉴一下:http://download.csdn.net/source/1262066