From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

DAQmx C# Example: Synchronize X Series and S Series Analog Channels with an Analog Reference Trigger

Code and Documents

Attachment

Overview

This example demonstrates how to synchronize a S Series card to a X Series card and acquire a finite amount of data using an internal clock and a analog reference trigger in .NET C#.

Description

In this example, the S Series device has been made the master and the X Series device has been made the slave. The reason for this is that the S Series synchronization has the least flexibility compared to the X Series that has PLL circuitry as well as access to the master timebase where the S Series only allows access to the master timebase for Analog circuit. Along with this, the X Series card has a faster timebase so it is easier to export the low frequency timebase from the S Series device to the X Series device.

Steps to Implement Code

  1. Select the physical channels corresponding to where your signal is input on the DAQ device. Master is the S Series and Slave is the X Series
  2. Enter the minimum and maximum voltage values. Note: For better accuracy, try to match the input range to the expected voltage level of the measured signal
  3. Select the number of samples per channel to acquire
  4. Set the rate in Hz for the internal clock. Note: The rate should be at least twice as fast as the maximum frequency component of the signal being acquired
  5. Set the Analog Reference level as well as the polarity of the reference edges. Additionally, set the number of pre-trigger samples to be acquired

Code Execution Steps

  1. Create a new task for Master and Slave Task
  2. Initialize Master and Slave Local Variables
  3. Create the Master and Slave Channel
  4. Configure Master Slave and Master Timing Specs
  5. Configure Analog Reference Trigger
  6. Verify the Master and Slave Task (This verifies that the DAQmx task has been configured correctly.)
  7. Get Master Device name in order to export the trigger through backplane
  8. Set the Master Timebase of the X Series device to the Sample Clock Timebase on the S Series device
  9. Configure a start trigger on Slave task to start when the reference trigger on the Master occurs
  10. Verify that the Synchronization steps above
  11. Prepare Data for the table and wait for the trigger
  12. Read data from the channels and display the data

Requirements

Software

Visual Studio for development

.NET framework

NI DAQmx driver


Note: Can run executable without Visual Studio (exe is in Synchronize X-S_Series\CS\obj\Debug folder)


Hardware

PCI S Series card with analog trigger line (NI-611x or NI-6120)

PCIe X Series card

Shared trigger line (RTSI cable)


Additional Images

Front Pannel.png



Jim St
National Instruments
RF Product Support Engineer

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

Contributors