Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi
I am writing an application to read weighing scale reading of a milk dairy.

The instrument has got RS232 Port and I have purchased a USB converted to connect this to my laptop.

weighing machine is of class 3.
I am using Serial Port option in vb.net 2010

"COM13", 9600, Parity.None, 8, StopBits.One

I am unable to open the connection but unable to read the data.. I am using following code to read the data

VB
Private Sub port_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles port.DataReceived
        Try
            If port.IsOpen = False Then port.Open 
            ReceivedText(port.ReadExisting())
        Catch ex As Exception
            MsgBox(ex.Message)
            Exit Sub
        End Try
    End Sub()

 Private Sub ReceivedText(ByVal [text] As String)
        If Me.rtbReceived.InvokeRequired Then
            Dim x As New SetTextCallback(AddressOf ReceivedText)
            Me.Invoke(x, New Object() {(text)})
        Else
            Me.rtbReceived.Text &= [text]
        End If
    End Sub

 'rtbReceived is a Rich text box


I am getting some garbage data which needs to be purified... and unable to get data all the time.

don't no how to connect and how to get data.

have tried port.write("P") and port.write("T") and port.write("P").... but without any result ... message received as operation timed out.

Please help me to get the result

Thanks and regards
Santosh Sharma
Posted

1 solution

You should talk to the people who created it - they should provide technical support and will know more about their product than we will. If they don't, then find another supplier and demand your money back!

It's almost certainly that the data isn't in the format you expect, or the data comms parameters are wrong. So talk to the people who know!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900