Example Code

DAQmx Multidevice Synchronization – E Series and M Series

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

    Driver

  • NI-DAQmx

Code and Documents

Attachment

Description

Part of the M Series Synchronization with LabVIEW and NI-DAQmx Example Set

 

E Series devices have been leading the market for data acquisition products for many years, and with the introduction of the new NI M Series devices, we feel strongly that NI multifunction data acquisition devices will continue to lead the market. As a result, it is important that current E Series users be able to use both E and M Series devices simultaneously. For this reason, this section presents the recommended method for synchronizing E Series and M Series devices.

E Series and M Series devices employ slightly different techniques for synchronization. To synchronize operations across multiple E Series devices, one device will export its 20 MHz master timebase to be used as the master timebase for the other devices. Although an E Series device can input a slower signal, such as 10 MHz, for its master timebase it cannot multiply that timebase up to re-create a 20 MHz timebase. Therefore, the resolution of the internal sample clocks that the E Series device could create by dividing down this external master timebase would be decreased. M Series devices cannot directly route out their internal 20 MHz timebase over the RTSI bus. M Series devices are able to directly route out only their 10 MHz reference clock. Therefore, the E Series device should be used as the master device when synchronizing an E Series and an M Series device. In this case, the E Series device can route out its 20 MHz master timebase to be used as the reference clock source for the M Series slave. The timebase on the M Series device would then be in phase with the 20 MHz master timebase of the E Series device.

Another behavior difference that must taken into account when synchronizing E and M Series devices is the difference in the default sample clock delay. The sample clock delay is the delay between when the AI Sample Clock occurs and when the first AI Convert Clock pulse for that scan occurs. With E Series, this default delay is 2 ticks of the master timebase, which is the minimum value allowed. With M Series, the default delay is 3 ticks of the timebase being used. Therefore, to more precisely synchronize an E Series device with an M Series device, change the E Series device to have a sample clock delay of 3 ticks. Figure 1 below demonstrates this behavior.

 

photo.jpg
Figure 1 Default DelayFromSampleClk of E Series and M Series

 

Figure 2 is an example on how to synchronize an acquisition between an E Series and an M Series device.

 

photo.jpg
Figure 2 E Series-M Series Synchronization

 

  1. In step 1, both the E Series and M Series analog input channels are created. The initialization procedure acquires the basic information needed to describe the operation.
  2. Using the DAQmx Timing VI, the two sample clocks are defined for continuous or finite acquisitions. Both devices are set to use the same sample rate. The clock source is not defined by the DAQmx Timing VI.
  3. Using two property nodes, the master timebase source and rate from the E Series device are routed to the M Series reference clock source and rate. By doing this, the M Series device will phase lock its internal timebases to the 20 MHz master timebase from the E Series device.
  4. In addition, the DelayFromSampleClk of the E Series device has to match that of the M Series device. This delay represents the number of timebase ticks after the sample clock and before the first convert clock (see Figure 8).
  5. In step 5, the Get Terminal Name with Device Prefix VI extracts the device name and appends the input string as a terminal name. The DAQmx Trigger VI causes the M Series analog input operation to wait for a digital trigger to begin executing. The source of this trigger is defined as the analog input start trigger from the E Series device. As a result, the E Series and M Series analog input operations will begin simultaneously.
  6. At this point, the two analog input operations have been started with the DAQmx Start Task VI. The M Series analog input operation has been configured to wait for a start trigger and will not execute until the E Series device begins data acquisition. The sequence structure ensures that the M Series analog input process has been started and is waiting for a digital trigger. The two DAQmx Read VIs will read a finite number of samples.
  7. In this last step, the tasks are cleaned and the errors are handled. Both error clusters (from both tasks) are merged and wired into the error handler.

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors