Click here to Skip to main content
15,943,131 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

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.
Posted

1 solution

Hello
Does the SerialPort have a significant delay when receiving or sending data?Did I get data, and then only know about it 20ms later?
The Short answer is No. There is not any specified time.


I am checking SerialPort.BytesToRead and not using the dataReceived event.
maybe this helps, Look at this please:
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900