01-23-2013 10:18 AM
The attached vi contains the code I am trying to write to simultaneously play out analog output on 5 different PXI-6733 cards I also have a PXI-6682 card and am using LabVIEW 2011 software.
At any rate what I would like to do is create a playback tool that I send in data with channel mapping and based off the channel mapping files my code automatically determines what channels should be on or off, and routes the data to the channels accordingly. The program below contains my current progress. I can run 3 different cards with the same sine wave and I do not skew with time, and all 3 start at the same time. Now what I would like to do is be able to turn off entire cards at the start of my program based on the configuration sent over to the file. For example I may just want to run Cards #1, 2, and 5, 3 and 4 would be off.
I have tried using case structures but there is no good way to run the case structure through the stacked sequence as well as the while loop. So I suppose the brute force way would be to create a ton of case structures;
Case #1 only card #1 is on, Case #2, Card 1,2 are on, case #3 Cards, 1,2,3.... however some how there has to be a better way than this. Can anyone point me in the right direction?
I have searched quite a bit and can't seem to figure out how to programatically turn on/off different cards.
Thanks,
Adam
01-23-2013 11:15 AM - edited 01-23-2013 11:18 AM
I am guessing, you never would want to turn off your master loop. If that is the case, leave the master loop as is, and combine all your slave channels to one slave task.
Channels can be combined in to one task even if it is on different devices or different measurement types for Analogue Inputs (Look at example Analog Input - Voltage and Thermocouple in a Single Task.vi") , I ASSUME it is the same for Analogue Outputs as well.
So you just pass the channels you require in the slave task, for example if you do not need dev5 just pass Dev2/ao0, Dev2/ao1, Dev3/ao0, Dev3/ao1 as your channels. Hope that helps.
01-23-2013 11:40 AM
aCe, I am away from my lab based computer with labVIEW right now, but am I actually able to hand multiple devices to a single task? I didn't realize I was able to do so. If so are there any examples that show how to do this or is this just so straight forward that they can simply be sent in in the form of an array?
I will have to play with this later.
Thanks,
Adam
01-23-2013 12:55 PM
The example mentioned above has something similar.
01-23-2013 01:06 PM
Which example?
See my current code, how do I take those established channels and input them such that they go through with simple comma separation? I have tried inputting both as an array, as well as a concatenated string with comma separation. I must be missing something. Is there a good example I can look at that shows this being done? How do I tell it to play back PXI1Slot4/ao0,PXI1Slot5/ao0,PXI1Slot6/ao0?
Thanks,
Adam
01-23-2013 01:11 PM - edited 01-23-2013 01:12 PM
Example that ships with labview: "Voltage and Thermocouple in a Single Task.vi"
You could wire your array directly in to "DAQmx Flatten Channel String.vi" that is found in the Daqmx utilities palette.
01-23-2013 01:45 PM
I have done exactally what you suggest, but the system now comes back with an error -200558 saying that "One task cannot contain multiple independant devices, create one task for each independant device" it then goes on to list all the offending devices.
So is this behavior actually supported? I have seen a system that does more or less what I am trying to do and I know it was built in labview but I only have the executable not the source code, so no way to know what they did.
Here's my code if needed, but it is pretty straight forward.
01-23-2013 02:31 PM
Hi,
Sorry, your error is expected and is explained here: http://digital.ni.com/public.nsf/allkb/6A97D0F3CFE57EC28625734F0070DF4D some devices dont support it.
01-24-2013 08:16 AM
Hi aCe, well in that case I am back to where I started with the challenge of how do I actually go about having a variable number of avialable cards when I want to send out analog output? I am envisioning a panel where the operator has a bunch of input signals, and he selects what channels, cards etc... he wishes to use. I then need my VI in the background to support their choice what ever it may be.
Any ideas/suggestions or articles I can follow that would show how to do this?
Like I said we even have a executable program written in LabVIEW that does some of this, however it doesn't do exactally what I need it to do and I don't have the source code to start modifying it.
Thanks,
Adam
01-28-2013 10:00 AM
Adam,
Are you just trying to output on the five cards? Do you want to programmatically add more cards? How many channels of output are we trying to accomplish? What sort of signals are we trying to output, simple DC or arbitrary waveform?
Once we have more info we can better recommend a solution for you!