Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create virtual channels in NI-DAQmx under Linux?

I'm running LabView 8.5 under SuSE 10.2. I have my hardware environment set up using nidaqmxconfig and I can see the defined hardware in the NI-DAQmx examples. So far I haven't been able to figure out how to create virtual channels under Linux.  Nearly everything I've found points me in the direction of tools that only run in Windows, so I'm confused.

Chris

0 Kudos
Message 1 of 13
(6,274 Views)
Hi Chris,

The NI Developer Zone article: Programming Data Acquisition for Linux with NI-DAQmx Base describes how to set up a channel in Linux using the DAQmxBase driver.  The article also mentions where to find some example programs.  Let us know if you have any other questions. 


Best Regards

Hani R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 13
(6,251 Views)

Hi Chris-

It looks like you're using NI-DAQmx for Linux, so the NI-DAQmx Base tutorial will not be helpful. 

In order to create persisted Global Virtual Channels and Tasks in NI-DAQmx for Linux you need to use the NI-DAQmx Storage VIs.  These are available from the Measurement I/O>>DAQmx - Data Acquisition>>DAQmx Advanced>>System Setup>>DAQmx Storage palette in LabVIEW.  You'll need to set up your channel or task and all parameters programmatically and then use the Storage VIs to save them into the DAQmx persisted storage database.

This example program entry provides a couple of LabVIEW 8.0 examples that show how to use the NI-DAQmx Storage API.  Those examples should be a good starting point to help with your system configuration.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 3 of 13
(6,246 Views)
Thanks, this is starting to make a lot more sense now.

What I'm eventually going to have to do is take data on several channels, more or less at once. In one case I really need the data to be collected simultaneously so I'm using a PCI-6122. In another I need to take data at about the same time, but not really simultaneously,so I'm using a PCI-6221.

Is there a way to define a virtual channel that lets me acquire from multiple channels at the same time (within the limits of the hardware, of course) or do I need to set up multiple channels in parallel? (I assume that if I want to take data from both the 6122 and the 6221, or if the channels on the same card need different scales the acquisition will have to be handled in parallel. Is that correct?)

thanks,
Chris

0 Kudos
Message 4 of 13
(6,229 Views)

Hi Chris-

In order to contain multiple channels with similar timing information but dissimilar (or similar) channel options (such as input range, coupling, input configuration, etc) you will need to use an NI-DAQmx Task.  A Task can contain multiple persisted Global Virtual Channels, or it can contain virtual channels created at runtime via the DAQmx Create Channel VI. 

In general, most DAQ hardware (including the two devices you mention) only allow one analog input operation to run at any given time due to the fact that only one AI timing engine is available.  So, DAQmx limits in software the ability to run one task at a time.  You can not run multiple AI operations in parallel independently of one another, but you can group multiple virtual channels within one task and share the timing information between the multiple channels.

For your case where the application might need to adapt based on the DAQ device in use, I would suggest using the NI-DAQmx LabVIEW API to create your channels and tasks rather than creating them as persisted entities.  This will allow you to change the channels in use and their parameters at runtime rather than having to create persisted tasks and channels for each possible hardware configuration.

I have attached a quick example that shows how to combine two channels or lists of channels into a single task.  The timing and triggering information will be shared by all channels in the task, but the individual channel parameters (i.e. channel range, input configuration) can vary within the same task.  In case you have trouble opening the VI, here's a screenshot of the block diagram:



Message Edited by Tom W [DE] on 11-05-2007 03:52 PM
Tom W
National Instruments
Download All
Message 5 of 13
(6,223 Views)

Chris-

I'm not able to edit my last post for some reason, but I wanted to point out that you will need to insert a DAQmx Start Task VI between the DAQmx Sample Clock VI and the beginning of the While loop execution in my previous example.  Apologies for any confusion.

Tom W
National Instruments
0 Kudos
Message 6 of 13
(6,218 Views)
Thanks, again.

I'm actually doing several different types of measurements, one that measures pressures at a slow rate on one apparatus and another that measures sound pressures from microphones at a fast rate on a different apparatus. What I'm probably going to do is set them up as several different experiments rather than configure at run-time, although the sound pressure experiment has options for 2 or 4 channels of data collection so that might be a run-time choice.

What I will likely have to do for the sound pressure rig is grab two pieces of data (temperature and barometric pressure) at the beginning of the run from the 16 channel 6221 board and then a stream of data on 2 or 4 channels from the 6122  My PCI-6122 is listed as an "S" series simultaneous sampling board so it seems like I should be able to get  all four channels running at the same time. WOuld that use the same kind of structure you used in the example you provided for me?

Thanks again,
Chris

0 Kudos
Message 7 of 13
(6,213 Views)

Hi Chris-

Absolutely- you can group channels with similar input ranges, measurement types, and configurations into a single DAQmx Create Channel VI using the syntax "DevX/aiN:M" where X is the device number and N and M are the boundaries of a sequential list of channels.  For other channels or channel lists with dissimilar channel parameters you can then daisy-chain multiple DAQmx Create Channel VIs with appropriate input parameters.  Each call to DAQmx Create Channel will add the new virtual channels to whichever task you provide to the Tasks/Channels in input of DAQmx Create Channel.

So for example, you could call the DAQmx Create Channel VI instance for sound pressure with 2 channels on your S Series board and then call the DAQmx Create Channel VI for voltage input for a third or fourth channel on the same board if needed.  The biggest limitation to keep in mind is that the task must only contain channels from the same device, so you will need to create two seperate tasks for the M Series- and S Series-based measurements you'll be making. 

One notable caveat to this rule is the fact that multiple S Series devices can be contained within the same task if the devices are connected via RTSI or a PXI chassis backplace.  In that case you could create a channel list to the DAQmx Create Channel VI of the form "DevX/aiN:M, DevY/aiJ:K" where X and Y would refer to two seperate S Series devices.  Since it sounds like you're only using on S Series device this probably won't help, but you might consider it if your system expands in the future.

Tom W
National Instruments
0 Kudos
Message 8 of 13
(6,208 Views)
Thanks to you help (and the code you pointed me at) I've been able to create several scaled Global channels. How do I delete a global channel or a scale that I've saved? I've got a couple where I've either messed up the name or the scaling and would like to prune back my list to only keep the good ones.

Also, I'm driving a couple of solenoids with SCC-DO01 modules in  an SC-2345. Can I generate global channels for those, too or do I just use a string with, for instance,  SCCA-DO1 in it as the input to Task/channels in on the DAQmx Write vi?

thanks,
Chris

0 Kudos
Message 9 of 13
(5,858 Views)

Hi Chris-

You should be able to delete the superfluous channels and tasks using the DAQmx Delete Saved Global Channel and DAQmx Delete Saved Task VIs.  I don't have a Linux/DAQmx test box here now, but they're supported on Windows and should be supported on Linux as well.

You can create digital I/O global channels for the SCC modules.  You may want to manually edit your DAQmx config file to include the SCC carrier and/or modules so that the I/O controls will populate correctly in LabVIEW.  More info about using nidaqmxconfig with SCC/SCXI is available here.  An example configuration entry for an SCC carrier and module is shown here.



Message Edited by Tom W [DE] on 02-25-2008 04:26 PM
Tom W
National Instruments
0 Kudos
Message 10 of 13
(5,829 Views)