C# Signal Processing Plotting Rapid Data <p>I have a circuit that sends me two different data from sensors. Data is coming as packets. First data is '$' to separate one packet to another. After '$' it sends 16 bytes microphone data and 1 byte pulse sensor data. I have an array to store incoming data and after plotting the data in each 20 ms, i start to write new bytes from zero index of array. I need to plot these data to different graphs using ZedGraph. However i could not separate those data correctly. Sometimes one or more data of audio are shown in other graph. Here is my code:</p> <pre><code> for (int i = 0; i &lt; 4; i++) { if (data[i * 18] == Convert.ToByte('$')) { for (int x = ((i * 18) + 1); x &lt; ((i * 18) + 17); x++) { listAuido.Add(time, data[x]); } for (int a = ((i * 18) + 17); a &lt; ((i * 18) + 18); a++) { listPulse.Add(time, data[a]); } } } </code></pre> <p>How can i solve this issue? </p> <p>Circuit settings: BaudRate: 38400, Frequency: 200hz, CommunicationType: RS232.</p> <p>Port Settings:ReadTimeOut=5 WrtieTimeOut=5;</p> <p>While reading data i am using codes below. Read_Data1 refers data[] the code above. I have a counter and after plotting the data its value equals zero and i prevent my buffer <code>index out of range exception</code></p> <pre><code> byte[] Read_Data1 = new byte[1000]; private void myPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { if (!myPort.IsOpen) return; if (myPort.BytesToRead &gt; 0) { byte[] buffer = new byte[myPort.BytesToRead]; myPort.Read(buffer, 0, buffer.Length); DataConversion.bytetobyte(Read_Data1, buffer, buffer.Length, count); count += buffer.Length; DataRecord.SaveBytesToFile(buffer, save.FileName); } } public static void bytetobyte(byte[] Storage, byte[] databyte, int datacount, int count) { int abc; for (abc = 0; abc &lt; datacount; abc++) { Storage[abc + count] = databyte[abc]; } } </code></pre>