Solved

Trying to read COM Port hangs up

Posted on 2009-04-08
1
139 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
ID: 24105242
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

808 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