LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous DAQmx Tasks

Greetings,

I'm still learning the ins and outs of DAQmx and have run into a bit of a problem with code running on my USB 6008.  

Using NI's State Diagram Toolkit, I have a State in which I'm acquiring analog data from two channels.  I was able to configure a Task in NIMax to do this easily.  However I also need to monitor a digital input in this same state to capture a time value.  

The code as I currently have it crashes LabView completely as soon as the digital input is triggered.  I'm guessing I probably need to add this Task to the analog acquire.  But I'm not quite sure how to do this, or if it's even possible.  

The only other approach I can think of is to begin my data acquisition in one state, but not wait for it's completion before moving to another.  I'm just not sure how to do this.  

As always there's a big time crunch.  Any input greatly appreciated. 
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 1 of 18
(4,198 Views)
This must either be a really tough, or a really stupid question.   😉
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 2 of 18
(4,158 Views)
Does it give an error before it crashes? (One can always hope)

How much data are you sampling on each channel? There is a file I/O bug that causes crashes proir to displaying error when the data write is sufficently large, but does display the error when the data write is small.

I sync the time databases when I want to DAQmx tasks to be simultaneous.  But that is between two physical devices... I agree that it may not even be possible to have the same signal from the same device in two places in two different forms.
Message 3 of 18
(4,145 Views)
Unfortunately there is no error code as it's Windows that is shutting down LabView.  (You know, the "would you like to send a report" crash)

I'm acquiring 1000 samples at a rate of 1000/second on two channels, while at the same time watching a digital input.  

There's no problem acquiring the analog data.  But something about that digital input is taking LabView right now.  The interesting thing is that it doesn't crash until the digital input changes state.  

I started experimenting with moving things in and out of that particular "State".  But had no luck before I had to jump back onto something else that was "hotter".  

My guess is that I still can't have two tasks starting at the same time, whether they're of different types or not.  The problem here is that I can't seem to figure out how to add the digital input to a "multi" task. 
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 4 of 18
(4,143 Views)

From what I can see of your diagram this should work just fine.  It is hard to tell without seeing what you have configured in the individual tasks but it shouldn't matter.  I would suggest reporting this to NI Support so they can investigate it further.  You should not need to add the digital task to the AI task.  There are examples which ship with DAQmx which show how you can accomplish this so I know it works.

 

StuartG

Message 5 of 18
(4,120 Views)
I thought it should work too Stuart.  The analog task in the diagram there is configured to acquire 1000 samples on each of two channels over one second.  

The digital task is setup as 1 sample, on demand.  This is how I've setup triggers in the past and it's always worked.  

What's really odd is that I'm not getting any LabView errors at all.  It just crashes completely.  Usually something has to be pretty messed up to do that. 
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 6 of 18
(4,118 Views)

Hi,

Even if something was configured incorrectly, all you should see is an error. LabVIEW should not shut down. I would like to try and replicate the crash. Could you post the code itself on the forum? Also, any screenshots would be helpful.

Regards,

Hal L.

0 Kudos
Message 7 of 18
(4,089 Views)
Thanks for the reply Hal.

This is the latest (still incomplete) version of the code I'm running.  

There are still many portions of this code that are incomplete, so the error I'm getting could very well be caused by something I've not had a chance to look at yet.  

I've included the Max config file with the global tasks defined.  I've also used some OpenG VIs in this code that I can also post if required.  

Hopefully I'll have some more time to spend on this today. 
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 8 of 18
(4,061 Views)

Hi,

There are a couple of Sub VI's that are missing, so I cannot run the code. Could you please include them? Also, it will be much easier for me to run and troubleshoot this if you do the following:

Use LabVIEW to create the tasks instead of MAX - this way I will be able to see all of these configurations.

Simplify your code as much as possible to where you still see the LabVIEW crash.

Regards,

Hal L.

Message 9 of 18
(4,041 Views)
I wanted to reply while the topic still has some life in it.

Unfortunately my inexperience is going to show badly here, as I'm really having trouble manually configuring the tasks that I'm using.  I'm reading the documentation and struggling with it.  I can't predict when I'll "get it".  

The actual problem I'm trying to solve is this:

One digital trigger will start a timer, and begin acquiring 1000 samples over one second.  

When the second digital trigger is tripped, the time since the first digital trigger occurred needs to be recorded.  It also needs begin acquiring 1000 samples over one second.  

Then I need to do some post process analysis on the data acquired from both channels.  In this case I'm finding the max peak, and the time it occurred.  

I'm using the State Diagram Toolkit and perhaps this is part of my problem.  I can't seem to visualize how to begin acquiring on one channel while still waiting to begin acquiring on another.  It's very possible that both channels will be acquiring at the same time.  But it's also possible that they won't be.  

Unfortunately I'm the only one in our shop even attempting to use DAQmx, so I'm on my own for this one.  (I'm not even sure if this device will work under traditional DAQ)  

I'm going to to continue to struggle through what documentation and examples I can find.  But I'm starting to get that "Mime in a box" feeling.  

I'm just not sure what to try next. 
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 10 of 18
(4,024 Views)