none
can not read weight from Weighing Scale via rs-232 serialPort execll brand device RRS feed

  • Question

  • i want read weight from Weighing Scale with SerialPort without DataReceived event this way works for other brand but not working in this brand my configuration for serial port is like below:

            public string GetWeight()
            {
                var result = string.Empty;
                var comPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
                comPort.ReadTimeout = 10000;
                comPort.Open();
                var b = string.Empty;

                result = comPort.ReadExisting(); //
    comPort.ReadLine(); and ...


                comPort.Close();
                return result;

            }

    none of Read method of comPort doesn't read data and throw operation Timed out

    Sunday, September 16, 2018 11:09 AM

All replies

  • There are many things that can go wrong with serial port access.  Have you tried using a serial port application like TeraTerm to proe that it's sending data, and sending it at 9600 baud?  You don't have to send a "trigger" command to get it to send?  Remember that there's no buffering at all.  If the port isn't open when the string sends, you lose it.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, September 17, 2018 5:04 AM
  • Hi Mohsen Saleh,

    Thank you for posting here.

    For your question, I suggest you to look at the manufacturers details for the scale you are using: it should include the important details about the interface such as speed, bits per character, parity, and so forth, as well as the data format it is using.

    And then ensure that it works to connect it.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Stanly Fan Thursday, September 27, 2018 6:16 AM
    Tuesday, September 18, 2018 7:25 AM
    Moderator