From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

synchronized analog and digital data

Solved!
Go to solution

Hello all,

 

I would very much like some help with what I am trying to accomplish, if you don't mind.

 

I am trying to synchronize the acquisition of both analog and digital using a common trigger that starts both types gathering data at the same time. What I've done so far is mess around trying different combinations putting together the examples from LabVIEW 2011 about synchronization of data-- namely the "Multi-Function-Synch AI-Read Dig Chan.vi" and "Multi-Device Synch-Analog Input-Finite Acq-Analog Start.vi".

 

I tried to combine both because one contains digital and analog, the other contains triggering for multiple tasks.

 

I'm assuming I should place the trigger (whether it be digital or analog-eventually I'll want to choose either) and then call the "Get Terminal Name with Device Prefix.vi". But from here I'm not sure wheter to connect the terminal name to the sample clock of the digital channel or to a start digital edge trigger of the digital channel.


Also, the way it's wired now I get errors at the local terminal name, so I'm not sure exactly where this terminal should be coming from.

 

I'm trying my best, I could just use a little help, I've attached my attempt along with the examples I'm talking about.

 

Thank you.

0 Kudos
Message 1 of 10
(3,999 Views)

Hi beefcake,

 

This example shows how to synchronize an analog output and digital output. I know that you're trying to set up analog and digital input, but this example is still very close to what you're trying to accomplish. It shows how to set up the sample clocks and trigger, and how to start your tasks so that they are synchronized. 

 

I hope this helps!

Emily C
Applications Engineer
National Instruments
Message 2 of 10
(3,971 Views)

Thank you Emily,

 

I'll look through this example now and hopefully it will help, looks promising!

 

beefcake

0 Kudos
Message 3 of 10
(3,963 Views)

Sorry I've been sidetracked with some other projects, but I'm not back on this and have a few questions if you don't mind. I just want to make sure I understand this example before modifying for my own applications.

 

In the Sync AO and DO example, we create the counter which emits pulses, and the goal is to use that for the trigger of the analog/digital channels. 

 

So I understand we call "Get Terminal Name with Device Prefix.vi", using the output of the counter as the input terminal, and then send the information to the input of the digital trigger on the analog task line.

My question is why do we call that subvi in the digital task line?

Suppose I wanted to use just a digital/analog input as my trigger, would I then do something more like the example above with multiple devices?

Also, why exaclty does starting the analog task first ensure that the two tasks start simultaneously?

 

Thanks again for your help.

 

 

0 Kudos
Message 4 of 10
(3,944 Views)
Solution
Accepted by beefcake

Hi beefcake,

 

 The internal output line CtrInternalOutput is used as the sample clock for your digital output sample clock source. If you change the settings so your CO Pulse Time is Dev1, and your Digital Output is Dev2, you'll notice that the terminal name produced would give Dev2/CtrInternalOutput. So what you're getting here is how the digital output device sees it's sample clock, instead of the clock itself.

 

If you wanted to just use a digital/analog input as your trigger, you would do something more like the example above. Are you using multiple devices, or are all your lines on the same device? That example is more complicated because it is synching signals on multiple devices.

 

By looking at how this VI is wired, you can see that the digital signal triggers the analog signal. You want the analog signal to be started first so that when the digital signal triggers the analog task is already running and can trigger immediately. If the digital task started first it could trigger before the analog task had been started, and they wouldn't trigger at exactly the same time.

 

I hope this clarifies things. Regards,

Emily C
Applications Engineer
National Instruments
Message 5 of 10
(3,926 Views)

Hello all,

 

I am trying to reproduce this example and I can't get it work. I have the NI PXI-1042Q with two cards in it - NI PXI-6534 (DIO) and NI PXI-6259 (MIO).

Specifically, I don't know what should I specify as terminal input to the Get Terminal Name With Device Prefix.vi

Any ideas?

 

Thanks.

0 Kudos
Message 6 of 10
(3,862 Views)

maslick,

 

If you use context help, there is an example of how this VI works. Also, if you know how this should look as an output, you can create an indicator on the Terminal Name with Device Prefix output of the VI to check the string that is created. Here's a KnowledgeBase that gives a little more detail. What we're doing is programmatically creating a terminal reference for the device. I hope this helps!

 

How Can I Dynamically Determine Device Numbers?:

http://digital.ni.com/public.nsf/allkb/0B4B862AD0334A2286256D410068F0EF?OpenDocument

Robert B
RF Product Support Engineer
National Instruments
0 Kudos
Message 7 of 10
(3,819 Views)

Hey USBarnes,

 

My question was: what signal should start the trigger? The output of the Get Terminal Name with Device Prefix vi is: /DIO/StartTrigger and it throws an error: Error -89120 Source terminal to be routed could not be found on the device. If I specify the trigger source manually via create constant - I don't know what should I choose (see attached pic).

 

 

 

0 Kudos
Message 8 of 10
(3,798 Views)

My AIO card can produce CO pulses, my DIO can not. So I cannot pass DIO/Ctr0InternalOutput as a trigger for the AO channel. 

0 Kudos
Message 9 of 10
(3,779 Views)

maslick,

 

To determine lines that can be routed for your devices, select them in MAX and navigate to the Device Routes tab located at the bottom. This will show you which routes can be made directly and indirectly and their names. I hope this helps!

Robert B
RF Product Support Engineer
National Instruments
0 Kudos
Message 10 of 10
(3,762 Views)