Capturing Data Using MSComm via serial port

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cpraveen10
    New Member
    • Mar 2007
    • 4

    Capturing Data Using MSComm via serial port

    I want to capture the data through serial port using the below program...
    The data is 1A2B3C1A2B3C... .
    From that i want to display A in first text box, B in second text box and C in third text box.
    The code which i wrote is giving as B in first text box, 3 in second text box and C in third text box.
    COULD U PLS HELP ME OUT.

    Private Sub MSComm1_OnComm( )

    Dim data As String
    Dim data1 As String
    Dim data2 As String

    Dim i As Byte
    Dim i1 As Byte
    Dim i2 As Byte

    If MSComm1.CommEve nt = comEvReceive Then

    data = MSComm1.Input
    data1 = MSComm1.Input
    data2 = MSComm1.Input

    If Asc(Text) = 32 Then
    i = Asc(data)
    j = Hex(i)
    Text1(0) = j


    i1 = Asc(data1)
    j1 = Hex(i1)
    Text1(1) = j1

    i2 = Asc(data2)
    j2 = Hex(i2)
    Text1(2) = j2

    End If
    End Sub
Working...