Hallo,
ich habe ein Problem bezüglich des Datenempfangs über die Schnittstelle.
Ich sende dem Gerät etwas, Das senden funktinioert einwandfrei, jedoch
müsste ich eine Antwort bekommen, aber erhalte keine Antwort, das
Erreignis wird einfach nicht ausgeführt.
Hier ist mein Quellcode:
Dim Out As Variant
Dim Out_2(5) As Byte
Private Sub Port_Ein()
With MScomm
.CommPort = 1
.Settings = "4800,e,8,1"
.Handshaking = comNone
.InputLen = 1
.InputMode = comInputModeBinary
.RThreshold = 1
.SThreshold = 1
.PortOpen = True
End With
End Sub
Private Sub CommandButton1_Click()
Port_Ein
Out(1) = &H1
Out(2) = &H0
Out(3) = &H0
Out(4) = &H0
Out(5) = &H62
Out_2(0) = &H65
Out_2(1) = &H0
Out_2(2) = &H0
Out_2(3) = &H0
Out_2(4) = &H0
Out_2(5) = &H65
MScomm.Output = Out
MScomm.Output = Out_2
End Sub
Private Sub MScomm_OnComm()
Dim variable As Variant
If (MScomm.CommEvent = comEvReceive) Then
MsgBox ("Daten empfang")
variable = MScomm.Input
Range("A1") = variable(0)
Range("A2") = variable(1)
Range("A3") = variable(2)
Range("A4") = variable(3)
Range("A5") = variable(4)
Range("A6") = variable(5)
End If
MsgBox ("Schließe Port")
MScomm.PortOpen = False
End Sub
ich habe ein Problem bezüglich des Datenempfangs über die Schnittstelle.
Ich sende dem Gerät etwas, Das senden funktinioert einwandfrei, jedoch
müsste ich eine Antwort bekommen, aber erhalte keine Antwort, das
Erreignis wird einfach nicht ausgeführt.
Hier ist mein Quellcode:
Dim Out As Variant
Dim Out_2(5) As Byte
Private Sub Port_Ein()
With MScomm
.CommPort = 1
.Settings = "4800,e,8,1"
.Handshaking = comNone
.InputLen = 1
.InputMode = comInputModeBinary
.RThreshold = 1
.SThreshold = 1
.PortOpen = True
End With
End Sub
Private Sub CommandButton1_Click()
Port_Ein
Out(1) = &H1
Out(2) = &H0
Out(3) = &H0
Out(4) = &H0
Out(5) = &H62
Out_2(0) = &H65
Out_2(1) = &H0
Out_2(2) = &H0
Out_2(3) = &H0
Out_2(4) = &H0
Out_2(5) = &H65
MScomm.Output = Out
MScomm.Output = Out_2
End Sub
Private Sub MScomm_OnComm()
Dim variable As Variant
If (MScomm.CommEvent = comEvReceive) Then
MsgBox ("Daten empfang")
variable = MScomm.Input
Range("A1") = variable(0)
Range("A2") = variable(1)
Range("A3") = variable(2)
Range("A4") = variable(3)
Range("A5") = variable(4)
Range("A6") = variable(5)
End If
MsgBox ("Schließe Port")
MScomm.PortOpen = False
End Sub