To download NI software, including the products shown below, visit ni.com/downloads.
This example demonstrates how to synchronize multiple cRIOs together. Imagine you have several cRIOs that are distributed across the network and you want to be able to synchronize all of them together. How would you accomplish this goal? The code listed below will get you started. The idea behind the code is that there would several cRIOs that have an appliction (VI or as a start up executable) that listens for commands sent by the host. The commands are interpreted by the targets and the targets reply with the correct information.
Windows Host
The Host Broadcast Commands.vi can send any number of commands (Configure, Start, Stop, Ack, and Trigger Time) to the cRIO targets to invoke an action.
Configure - Returns target IPs address of the cRIOs listening
Start - Requests and returns a timestamp from the targets
Stop - Shuts down targets(all)
Ack - Handshaking mechanism to ensure messages are received
Trigger Time - Sends future time event to targets
** If you are going to synchronize multiple cRIO together, and wish to retrieve data from multiple targets consider using the Shared Variable API (LabVIEW 2009 and later)**
cRIO Target
The targets receive information from the host. The target uses the future event that is generated from the host application to ensure all of the targets start on time. The Slave Listen and Acknowledge Commands.vi is a VI that can be copied to multiple targets to synchronize multiple targets together. Since NI-Timesync allows us to synchronize multiple nanosecond engines together, we can use the Synchronize to the Scan Engine of a Timed Loop to achieve module synchronization. Once the timed loops are started the nanosecond engine will govern when the timed loop executes. If for some reason network communication is lost, the targets own clock will take over. If the connection is lost clock drift can occur. Once connection is re-established, the target will synchronize back to the other networked targets.
** There is a diagram disable structure that shows the IO Variables being used **
Resources:
Timing and Synchronization in NI LabVIEW
Using the NI Scan Engine (ETS, VxWorks, Windows)
Recommended Practices for Using the LabVIEW I/O Variable and NI Scan Engine
Buffered Network-Published Shared Variables: Components and Architecture
Additional Software:
LabVIEW 2010
LabVIEW RT 2010
NI-RIO 3.5.1
Simple Messaging Reference Library (STM)
NI-TimeSync 1.1 - Real-Time OS, Windows XP x86/Vista/7
Description-Separate-2Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
What accuracy can I achieve by the above example? I am working on a cRIO project where several cRIO units shall sample each channel at 50 kHz. After being time-stamped, the data will go through a FFT analysis (10th over-harmonic). I need a time accuracy of about 3-5 nano seconds.. We have done this earlier by use of GPS with PPS output (http://kontrollsystemer.no/node/view/269) and that works excellent. It would however be easier to avoid using extra hardware if 1588 can provide same accuracy.