What should i do on the coding if i only want to capture 1 time stamp for the data I received?
As data being received bit by bit, the time is also ticking.. As a result, now a time stamp is shown after every bit of data received.
Interval between each full set of data is roughly 10s apart while interval between each bit of data is roughly... 20millisec..
Coding as follows:
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
string time = DateTime.Now.ToString("HH:mm:ss.ff"); //Display Real time per received data
RxString = serialPort1.ReadExisting();
this.Invoke(new EventHandler(DisplayText));
StreamWriter MyStreamWriter = new StreamWriter(@"c:\test1.txt",true); //True tell SW to append to file instead of overwriting
MyStreamWriter.Write(time + " " + RxString); //Write time + string
MyStreamWriter.Flush();
MyStreamWriter.Close();
}