Solved

Trying to read COM Port hangs up

Posted on 2009-04-08
1
141 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
Deathrace earned 500 total points
ID: 24105242
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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