MSComm receive data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fabianuat
    New Member
    • Jan 2007
    • 3

    #1

    MSComm receive data

    Hello

    Im using the MSComm to send and receive binary data to a video server, the sending part works fine, but when a receive more than 8 byets, the input variable only keeps the bytes over the eighth byte. ...Please some can some one tell me where im wrong??? these are the settings and the OnComm part

    MSComm1.CommPor t = 1
    MSComm1.Setting s = "38400,O,8, 1"
    MSComm1.InputMo de = 1
    MSComm1.InputLe n = 0
    MSComm1.RThresh old = 1
    MSComm1.SThresh old = 1
    MSComm1.DTREnab le = True
    MSComm1.RTSEnab le = True
    MSComm1.NullDis card = False
    If MSComm1.PortOpe n = False Then
    MSComm1.PortOpe n = True
    End If



    Private Sub MSComm1_OnComm( )
    Dim buffer As Variant
    Dim Arr() As Byte
    Dim i As Integer
    Dim iTemp As Integer
    Dim sTemp As String
    Dim strINPUT As String

    Select Case MSComm1.CommEve nt
    Case comEvReceive
    Do While MSComm1.InBuffe rCount > 0
    buffer = MSComm1.Input
    Arr = buffer

    For i = LBound(Arr) To UBound(Arr)
    iTemp = Asc(Chr$(Arr(i) ))
    sTemp = Hex$(iTemp)

    If Len(sTemp) = 1 Then 'For display in a text box
    strINPUT = strINPUT & "0" & sTemp & " "
    Else
    strINPUT = strINPUT & sTemp & " "
    End If

    Text1.Text = strINPUT

    Next
    Loop
Working...