08-05-2011 01:34 PM
In one of my projects I had to synchronize 2 different devices - both programmed using RS-232.
Just for kicks I put together a VI that captures the 2 serial port Tx lines with an NI DAQ board. I wanted to find out how repeatable the message timing was - by measuring the difference in time between the start of the first characters.
Test details:
The PC was a nearly new DELL Precision T3500 with a 2.8 GHz processor running Windows 7 Pro, 32-bit.
I used LabVIEW 2010 to send the serial messages. Here's the basic code I used
COM Port 1 was the COM port typically found on a desktop PC.
COM Port 3 was one of the COM ports from a 4-port serial PCI card from Axxon.
Results:
In all cases, one port always transmitted before the other.
At 300 baud, the mean time difference was 1.48 milliseconds, and the Std Dev was about 80 microseconds.
At 9600 baud, the mean time difference was 0.17 milliseconds, and the Std Dev was about 18 microseconds.
08-10-2011 11:39 AM
Thanks for sharing the information. I am curious, how good of synchronization did your project require? One thing that comes to mind when trying to synchonize serial instruments like this, is that you really do not know how deterministic the instrument will be when it receives the message. For example, one instrument may interrupt on the incoming serial data and react immediately, while another instrument may only process the data in a slow polling loop.
08-11-2011 08:25 AM
Nice test, did you also try two ports on the axxon board?
Buried deep in the windows OS the are some setup values for the COM port that had do do with buffering and priority.... and could speed system reaction ... (to many years back we had to set certain values to make shure an ACK is send fast enough after receiving data on a RS232) maybe not needed with nowadays GHz power, but who knows?