I am trying to synchronize the clocks of 2 external devices down to 1/10th of a second using C# and the .NET System.IO.Ports.SerialPort class.
I send a command and wait for a response. I divide the time it takes to get the first byte of the response by 2, and send a command to the device to set its clock with the delay added on to the computer time. I then repeat the process on the other device. I can then take a picture of a digital readout of the time, and the clocks are never the same, sometimes differing up to 100ms.
I printed out a detailed account of the communications (what I sent and when) with the devices, and that all checks out. So my question is: does the SerialPort have a significant delay when receiving or sending data? Did I get data, and then only know about it 20ms later?
PS, I am checking SerialPort.BytesToRead and not using the dataReceived event.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)