![]() |
|
|
This example shows you how to synchronize AI for multiple USB devices.
Steps:
1. Create an analog input voltage channel for both the Master and Slave devices.
2. Set timing parameters. Note that sample mode set to Continuous Samples. In this example, the Rate must be the same for both devices since we are sharing the sample clock.
3. Route the Sample Clock of the Master Device to the Slave Device. Note that you will need to physically connect PFI0 on Device 1 to PFI0 on Device 2.
4. Call the Get Terminal Name with Device Prefix VI. This will take a Task and a terminal and create a properly formatted device + terminal name to use as the source of the Slave's Trigger. For the Slave, set the Source for the trigger to the ai/StartTrigger of the Master Device. This will ensure both devices start sampling at the same time.
5. Call the Start VI to start the acquisition. (Note: The flattened sequence structure is used to ensure the slave device is armed before the Master so that the slave device does not miss the trigger.)
6. Read all of the waveform data in a While loop. The 'Samples to Read' control will specify how many samples per while loop iteration to read. If either devices report an error or the user presses the 'Stop' button on the front panel, the while loop will exit.
7. Call the Clear Task VI to stop the acquisition and clear the tasks.
8. Use the popup dialog box to display an error if any.
There are no comments on this document