Solved

Trying to read COM Port hangs up

Posted on 2009-04-08
1
137 Views
Last Modified: 2012-05-06
I send a byte packet to request a value from my device, the packet is sent correctly however when it gets to  indvalue = IndicatorPort.ReadLine()
it just hangs nothing happens
Public WithEvents IndicatorPort As New IO.Ports.SerialPort 

Public CurrCOMPort As New ArrayList
 

Public Sub RequestProbeValues()

        Dim Packet(4) As Byte

        Dim intloop As Integer

        Try

            For intloop = 0 To CurrCOMPort.Count - 1

                IndicatorPort = CurrCOMPort.Item(intloop)

                Packet(0) = 42 'Constant BMS message

                Packet(1) = 4 'Constant Length of Table upload

                Packet(2) = 6 ' Constant Command of Table upload

                Packet(3) = 23

                Packet(4) = 152

                IndicatorPort.Write(Packet, 0, 4)

                System.Threading.Thread.Sleep(100)

                Read()

            Next

        Catch ex As Exception

            MessageBox.Show("Unable to Communicate  -Request Probe Value")

        Finally

        End Try

    End Sub

    Public Sub Read()

        indvalue = IndicatorPort.ReadLine()

    End Sub

Open in new window

0
Comment
Question by:cmdolcet
1 Comment
 
LVL 9

Accepted Solution

by:
Deathrace earned 500 total points
Comment Utility
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

10 Experts available now in Live!

Get 1:1 Help Now