01-12-2011 09:01 AM
Hi All,
We are basically trying to synchronize two devices with the help of labview. We have combined the VIs for both the device. Further, we are trying to make the clocks same for both of them. So to make sure if the code is functioning right, we want to know timestamp after operations of different sub VIs in the code. How do I go about doing this ? Will timestamp indicator solve my purpose ?
Thanks,
Kanu
01-12-2011 09:12 AM
That depends on what kind of resolution you need. If both clocks are synched to NTSC and you only need a few seconds of resolution you might be ok. One possibility is to use a network shared variable that one writes to and both read from. Someone else probably has better ideas
01-12-2011 09:15 AM
Thanks Steve. I tried using elapsed time express VI; just trying to figure out how to use it. I guess even if I don't know the exact time it should be fine; if I am able to figure out the relative time from start of the execution.
Regards,
Kanu
01-12-2011 09:25 AM
I am from the old school of thought. Convert the timestamp to double and subtract it. This will give you the difference in seconds.
Depending the accuracy requirements, you can make one of the machines an nttp server and have the second machine be a nttp client. This should synchronize the two machines within a second. If you need higher accuracy, I suggest a gps system. It should allow you to synch within couple of microseconds.
01-12-2011 10:28 AM
Thanks Joseph. I figured out the relative time using tick count. I appreciate all help.
Regards,
Kanu
01-12-2011 01:48 PM
Wach out for the tick count. It will roll over on you. The nice thing about get date/time in seconds is that it will not roll over. Well not for a while I think.
01-13-2011 08:45 AM
Be aware that, unless you are using RT or FPGA, the time returned by the VIs in the timing palette will only be accurate, to, at best, 20ms, and could be quite a bit worse. This is due to the multitasking nature of modern operating systems. The resolution of the timestamp is limited by your processor and your operating system (Windows variants are particularly poor).
Most National Instruments hardware includes VIs which return timestamps with the data. These timestamps are usually relative to some arbitrary reference point, such as when you reset or powered on the board. They will give you much better relative accuracy than depending on the operating system timestamp functions. Absolute accuracy is harder to do, although there are solutions available to sync to GPS or NTP data (which I have not done, so have no idea how to do them). In general, you are much better off using your hardware for timing information that your operating system.
As a side note, you do not need or want to change a timestamp to a double before subtracting to get the difference. Doing so loses a LOT of resolution. Of course, if you are using the operating system timestamps, the resolution is not being used, anyway, so it will make no difference.