How to receive 43 bytes of data from a Microcontroller using MSCOMM in VB 6 and display them onto a vb form ?

Posted on 2004-11-15
Last Modified: 2013-12-25
I am using VB6 and MSCOMM to create a link between my PC and Microcontroller.

I am sending 43 bytes of data to my Microrcontroller from an array of 43 bytes and writing it to the EPROM of my microcontroller. I wan to be able to read that data later on and display it on a form.

I can successfully receive a byte when a Comm RX event is triggered.

but not sure how to receive all 43 bytes and display them onto a vb form (form text, combo etc controls)

I am sending a query command to microcontroller then it sends me all these byte. I am able to see this data
coming on scope but not able to receive it. Please help ?
Question by:adnansami
    LVL 6

    Expert Comment

    Try this ...

    Private Sub Command1_Click()
       Dim InString As String
       MSComm1.InputLen = 43

       If MSComm1.InBufferCount >= 43 Then
             InString = MSComm1.Input
       End If
    End Sub


    Author Comment

    Thanks for the post
    I tired it and it did not work ?
    What about RThreshold property ? I want to receive all this on a comm event.
    How do I parse it and display it onto the controlls
    LVL 6

    Expert Comment

    You can try something like this ...

    Dim InString As String

    private sub Form_Load()
    ' ....
      MSComm1.InputLen = 43
      MSComm1.RThreshold = 43
    ' ....
    end sub

    Private Sub MSComm1_OnComm ()
       Select Case MSComm1.CommEvent
            Case comEvReceive      
                   InString = MSComm1.Input
       End Select
    End Sub


    Accepted Solution

    PAQed with no points refunded (of 75)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now