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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to sync and/or trigger NI-DAQmx devices in LabView

Solved!
Go to solution

I am using LabView 2009 with a cDAQ-9174 chassis that includes a NI 9263 analog out device and a NI 9222 analog input device. I've learned from the examples that I can sync the devices to the same sample rate. But I am looking to sync the devices such that the exact moment I start acquiring input data on a 9222 channel, the 9263 starts generating an output. Secondly, I am interested to know when using just this equipment, is there a way to very accurately trigger one device off the other with some delay. So in summary I am interested in two behaviors:

 

1) Synchronize a 9263 output channel to a 9222 input channel, such that the start of a 9222 analog input measurement triggers a 9263 analog waveform output. and,

 

2) Have the 9263's analog output start for example EXACTLY 100 samples (provided sample rates are synced) after the 9222 starts collecting data. In other words, a delayed trigger.

 

I imagine this is preferably done in hardware such that no software delays occur. Is this possible using these devices? Or do I need some external clocking mechanism?

 

Thank you!

0 Kudos
Message 1 of 8
(7,104 Views)

Hello,

 

I will suggest you to have a look at Timing and Synchronization Features of NI-DAQmx. This will give you details about how you can implement the same using the hardware and LabVIEW.

 

Few more reference like http://digital.ni.com/public.nsf/allkb/851828B06A20E01B862571DA0005591A?OpenDocument

And example like http://decibel.ni.com/content/docs/DOC-3882 will also help you.

 

Go through the links mentioned above and let us know if you face any issue with them.

 

Warm Regards,

Hardik Asawa

0 Kudos
Message 2 of 8
(7,080 Views)

So I am still having trouble using the 9174 device. To isolate the problem, I am trying to create an analog input (using a 9222) triggered when a counter hits say 100 rising edges (or a fixed time). Essentially, this application seems very similar to Fig 4 of Timing and Synchronization Features of NI-DAQmx that was posted above. Reading the 9174 user manual, I understand the chassis device does have internal counters. I am having a hard time figuring out how to use them.

 

I'm not sure I can even run the Fig 4 code properly. When I open the Fig 4 code from above, I can select "/cDAQ1/Ctr0InternalOutput" as the source for the "Start Digital Edge" box. But for the counter channel, if I do NOT have my 9401 digital module plugged in, there are no options. It is empty. If I DO have the 9401 plugged in, I see "cDAQ1Mod4/ct40 ...", where cDAQ1Mod4 is my 9401.

 

1) Is there a way to generate a timer/counter WITHOUT the digital module (using just the 9174 perhaps)?

2) If not, are there any examples of of how to use these counters, and tie them to one of the options in the dropdown for "Start Digital Edge"? (The 9401 only has PFI[0-7]) listed

 

Also, looking in the user manual, it says to look at the "Device Routes" tab in MAX, but I don't see a Device Routes tab.

 

Any further pointers or example code that already exists would be greatly appreciated!

0 Kudos
Message 3 of 8
(7,015 Views)

is the "Device Routes" maybe the cabling tab?

Product Support Engineer
National Instruments
0 Kudos
Message 4 of 8
(6,996 Views)

Thank you for the response. I'll take a look to see the cabling tab when I have access to the cDAQ again. Any ideas on questions 1/2?

 

0 Kudos
Message 5 of 8
(6,993 Views)

I found the Device Routes tab, and also read through the "C Series Connections for Counters". The output terminal for my NI 9401's Ctr0 is connected to PFI3. So based on this, for the Figure 4 example above, I set the counter channel to "/cDAQ1Mod4/ctr0". The CO pulse ticks source is connected to "/cDAQ1/20MHzTimebase". And the source of the start trigger is "/cDAQ1Mod4/PFI3". This is the error I get:

 

----------------------------------

Possible reason(s):

Specified route cannot be satisfied, because it requires resources that are currently in use by another route.

Property: CO.Pulse.Term
Destination Device: cDAQ1Mod4
Destination Terminal: PFI3

Required Resources in Use by
Source Device: cDAQ1Mod4
Source Terminal: PFI3
Destination Device: cDAQ1
Destination Terminal: ai/StartTrigger

Task Name: _unnamedTask<29>

----------------------------------

 

I know I'm not clearly understanding the routing to properly use Figure 4 as an example with my equipment. Any ideas?

0 Kudos
Message 6 of 8
(6,981 Views)
Solution
Accepted by topic author tzoom84

Hi tzoom84,

 

Going back to your original questions,

 

To do 1) and 2), I don't think you need to use counters.

 

The shipping example LabVIEW 2010\examples\DAQmx\Synchronization\Multi-Function.llb\Multi-Function-Synch AI-AO.vi is probably a good starting point for 1). (Possible problem: if you're using multiple AI timing engines at the same time, this example's assumption that the AI task has "ai/StartTrigger" is not valid. If this turns out to be an issue, you may need to replace Get Terminal Name With Device Prefix.vi with the DAQmx Trigger >> Start.Term property and add a call to reserve the task.)

 

For 2), add the DAQmx Trigger >> Start.Delay and DAQmx Trigger >> Start.DelayUnits properties to the AO task:

 

Start Delay.png

 

If you really do need to use counters, you can do so without the NI 9401 by using cDAQ1/_ctr0 through cDAQ1/_ctr3, which are internal channels: How do I Access Internal Channels on any DAQmx Device?

 

Brad

---
Brad Keryan
NI R&D
Message 7 of 8
(6,963 Views)
Brad,

Thank you very much for addressing 1 and 2. With that information i am pretty sure that answers my questions. I'll try it out soon.
0 Kudos
Message 8 of 8
(6,955 Views)