7,763
社区成员
发帖
与我相关
我的任务
分享
MSComm1.Output = "at " & Chr$(13)
if MSComm1.Input= "ok " then
debug.print "端口"
end if
Private Sub com_test()
On Error Resume Next
For comp = 1 To 8
MSComm1.CommPort = comp
MSComm1.PortOpen = True
If MSComm1.PortOpen = True Then
portp(comp - 1) = comp
End If
MSComm1.PortOpen = False
Next
End Sub
Private Sub com_test2()
For comp = 0 To 7
If portp(comp) > 0 Then
MSComm1.CommPort = portp(comp)
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 1024 '接收缓冲区的大小
MSComm1.InputMode = 1 '接收二进制型数据
MSComm1.PortOpen = True
bbb = MSComm1.Input
ffff = Len(bbb)
If ffff > 0 Then
Text11.Text = portp(comp)
End If
MSComm1.PortOpen = False
End If
Next comp
End Sub