大家好,
MSComm1_OnComm事件中Case comEvReceive时,非要在comEvReceive后面加个数字才能收到串口发过来的字符,比如Case comEvReceive1或Case comEvReceive22,不加数字就收不到,我的是WIN7系统,奇怪了,请问怎么回事?程序如下(简单测试的):
Private Sub Command1_Click()
MSComm1.Output = Text1.Text
End Sub
Private Sub Command2_Click()
MSComm2.Output = Text2.Text
End Sub
Private Sub Form_Load()
With MSComm1
.Settings = "19200,n,8,1"
.CommPort = 5
.InputMode = comInputModeText
.InputLen = 0
.SThreshold = 1
.RThreshold = 1
.OutBufferCount = 0
.InBufferCount = 0
If Not .PortOpen Then .PortOpen = True
End With
With MSComm2
.Settings = "19200,n,8,1"
.CommPort = 6
.InputMode = comInputModeText
.InputLen = 0
.SThreshold = 1
.RThreshold = 1
.OutBufferCount = 0
.InBufferCount = 0
If Not .PortOpen Then .PortOpen = True
End With
End Sub
Private Sub MSComm1_OnComm()
Select Case CommEvent
Case comEvReceive111
Text1 = Text1 + MSComm1.Input
End Select
End Sub
Private Sub MSComm2_OnComm()
Select Case CommEvent
Case comEvReceive111
Text2 = Text2 + MSComm2.Input
End Select
End Sub
我好像没有悬赏分了,不知道有没有人帮我解答,5555555~~~