I am attempting to sync data capture between two devices using the VISA serial tool. One device samples at 5000 Hz and the other at 4000 Hz, I would like to be able to start data collection at the same time to make the post processing easier.
One device has an internal timestamp and the other does not, so I have been using the 'Format date/time string' to timestamp both sets of data to make it consistent.
My question is, can I have both of these loops in a single VI, with a single boolean that starts data collection? (I have tried having a boolean in one loop that starts collection and created a 'local variable' [changed to control] of this boolean to have in the other loop)
When I have the equipment connected the loops seem to run at the slower of the sample times, but to test the VI without the equipment connected you can see the iterations of each loop are running at their own sample times (4000 & 5000 Hz).
Please describe more about the devices you're using. Typically, synchronization is implemented at the hardware level using triggers and clock sharing. The method you're talking of is just the software side of synchronization which is never reliable and you may not achieve your goals in this fashion.
Though you try to timestamp the data, it is timestamped when you read in the software but not when the device actually acquired the sample, this already adds communication delays and any execution delays due to OS or code implementation.
Thank you for your response.
One of the devices is an IMU that like you say has a hardware timestamp.
The other is an autocollimator that only provides angle data, so does not have the capability to provide a time stamp.
My thoughts were, if I use a software timestamp then at least they will be the same for each device?
Could you please be more specific about the IMU and the autocollimator, and perhaps share their datasheets/manual?
This will help the forum members to check if there is a way to synchronize them at the hardware.