none
can't received data from RS232 .

    Question

  • Hi all

    i try to connect my HIS application to lab devices , its connected by rs232 every thing is ok but i can't receive all data i try more than 15 example , the data come from rs232  like this (||||) when try to read it as Hex its received like this 04 05 66 .

    its ASTM format . please someone help me to read this type of data

    Tuesday, February 03, 2015 4:07 PM

All replies

  • Hello Arkan,

    DDE Example: Setup MS Access to receive data from RS232/RS232C ports:>

    http://dochome.programbl.com/rs232-cps-plus-pro/dde-example-setup-ms-access-receive-data-rs232rs232c-ports.html

    Termite: a simple RS232 terminal (this example contains a full project with source code):>

    http://www.compuphase.com/software_termite.htm

    Serial Communication using C# and Whidbey:>

    http://www.codeproject.com/Articles/8605/Serial-Communication-using-C-and-Whidbey

    • Proposed as answer by bouzidmed Wednesday, February 04, 2015 8:56 PM
    Tuesday, February 03, 2015 4:58 PM
  • thanks for your replay 

    i need a sample code that help me received a ASTM format from Lab instruments .

    Tuesday, February 03, 2015 5:54 PM
  • Hi arkan,

    Please provide more details about this issue. Like some code, error info and so on.

    About received data, please take a look at SerialPort.DataReceived Event

    Note the remarks section.

    From MSDN documents, This example adds a SerialDataReceivedEventHandler to DataReceived to read all the available data received on the COM1 port.

    using System;
    using System.IO.Ports;
    
    class PortDataReceived
    {
        public static void Main()
        {
            SerialPort mySerialPort = new SerialPort("COM1");
    
            mySerialPort.BaudRate = 9600;
            mySerialPort.Parity = Parity.None;
            mySerialPort.StopBits = StopBits.One;
            mySerialPort.DataBits = 8;
            mySerialPort.Handshake = Handshake.None;
    
            mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
    
            mySerialPort.Open();
    
            Console.WriteLine("Press any key to continue...");
            Console.WriteLine();
            Console.ReadKey();
            mySerialPort.Close();
        }
    
        private static void DataReceivedHandler(
                            object sender,
                            SerialDataReceivedEventArgs e)
        {
            SerialPort sp = (SerialPort)sender;
            string indata = sp.ReadExisting();
            Console.WriteLine("Data Received:");
            Console.Write(indata);
        }
    }
    

    Hope it will be helpful for you.

    Have a nice day!

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 04, 2015 9:41 AM
    Moderator
  • hi

    thanks for your replay , i used this example from MSDN documents and its give me some thing like 

    |||||

    please any help 

     

    Wednesday, February 04, 2015 6:56 PM
  • hi all

    my app is still so slow and not got a data its just garbage 

    any help ???

    Thursday, February 05, 2015 4:09 PM
  • Hi arkan,

    >>the data come from rs232  like this (||||) when try to read it as Hex its received like this 04 05 66

    From this message, do you mean send as Hex like (04,05,66) but receive (|||)? Am i right?If so your title is wrong.

    Like you said,its ASTM format. Could you provide a link as to the definition of ASTM?  Per my understanding, there is a data parse problem.

    And there is a Serial debugging tool, it should be helpful for you to test it.

    This tool is used to sixteen hexadecimal ASCII code or receiving or sending any data or characters.

    RS-232 serial snoop tools for protocol development / debugging

    http://software.downloads.ms/windows/education/Serial-debugging-assistant-V4-0--green-free-version--2904.shtml

    Have a nice day!

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, February 06, 2015 2:51 AM
    Moderator
  • thanks Kristin foryour reply

    yes it's ASTM data because i configre the sender to sen it as ASTM , i use an RS232 Switch and its connected to my pc by USB and connected to the instrument by RS-232 ,  i test it by use some software like 232analyzer and it give me a data as ASTM and its fast and stable but when i use my own software its verey slow and give me wrong data like ||||| and when try to convert it to hex it 04 05 06 , i spent a lot of time with it tring get data. can anyone tel me where is the wrong ?????

    Friday, February 06, 2015 5:41 PM
  •  >>I test it by use some software like 232analyzer and it give me a data as ASTM and its fast.

    Ok, so RS-232 is fine. From my point of view,even though you only see '|||||', that does not mean it is an error. You are seeing the data in this way because the values cannot be displayed as characters on the screen. You will most likely have to contact the manufacturer to figure out how the data is formatted(in your own software ). Good Luck!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 09, 2015 8:16 AM
    Moderator