none
online high speed charting data RRS feed

  • Question

  • hello I design a application with c# 2017 for receiving and charting data with Serialport  and i can receive data and listing that but i can't charting that in high speed (every byte receive in 150 nano second)

            private void button2_Click(object sender, EventArgs e)
            {
                
                aserialport = new SerialPort(comboBox1.Text);
                aserialport.Close();
                aserialport.BaudRate = 115200;
                aserialport.DataBits = 8;
                aserialport.Parity = Parity.None;
                aserialport.StopBits = StopBits.One;
                aserialport.DataReceived += new SerialDataReceivedEventHandler(serialDataReceivedEventHandler);
    
    
                if (!aserialport.IsOpen)
                {
                    aserialport.Open();
                }
    
            }
    
            private void serialDataReceivedEventHandler(object sender, SerialDataReceivedEventArgs e)
            {
                SerialPort sData = sender as SerialPort;
                string recvData = sData.ReadLine();
                
                //serialData.Text += recvData.Replace("\0", "");
                serialData.Invoke((MethodInvoker)delegate { serialData.Text += (recvData.Replace("\0", "")+"\n"); });
    
                //initialization of chart update
                double data;
                bool result = double.TryParse(recvData, out data);
                if (result)
                {
    
                   serialDataChart.TriggeredUpdate(data);
                }
            }

    Sunday, August 18, 2019 6:53 PM

All replies

  • Hi h_sb97, 

    Thank you for posting here.

    Based on your description, I have a question to confirm with you.

    Do you want to update charts in high speed or receive data using SerialPort in high speed.

    Besides, could you provide more details or some code about ‘serialDataChart.TriggeredUpdate(data)’ ? It will help us to analyze your problem.

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    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.

    Friday, August 23, 2019 8:57 AM
    Moderator