LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create virtual channel with dynamic/configurable input

Hello,

 

We currently have a few programs which we use in house which allow you to select voltage input, temperature input, current input, etc from within the standalone LabView program. The limitation is then that the dropdown menu we have is populated by options which have to be added in with cases. So, essentially, if I suddenly need to read an RTD, which isnt one of the cases we already have, it is not possible, because the dropdown menu only contains three cases (voltage, current and temp). Now, we could simply add a case for every single possibility, so that no matter what we plugged in we would be covered, but I have to assume that there is a better way of doing this, possibility even dynamically.

 

When you drop a DAQmx virtual channel into the VI, it has a dropdown which you manually select, and then it is locked to that. Is there not a way to dynamically control this with an input? Or better yet, query the device to see what it is capable of outputting, and then giving just those options for selection from within the standalone LabView program that we distribute in house? And before it is suggested, we would really prefer to avoid using external tasks made with NI MAX, which are then referenced.

0 Kudos
Message 1 of 4
(1,480 Views)

There's a Man (Irving Berlin), a Broadway Show ("Annie Get Your Gun"), and a Song ("Anything You Can Do, I Can Do Better") whose title, for LabVIEW, would be "Anything MAX Can Do, DAQmx Can Do Better" (though it will take a little more work).

 

Let's say you have a number of DAQ Devices connected to your computer, and you want to find the USB-6001.  Write yourself a "Find DAQ Device" consisting of the following:

  • DAQmx System Node (found on Advanced/System Setup Palette) showing DevNames.
  • Take Array of Names into a For Loop that has a DAQmx Device Node (also in Advanced/System).  Wire the Dev Name Array element into the "Active Dev" input terminal.  Use resulting Product Time and DevSerialNum to look for/identify specific devices.  For example, "USB-6001" with a particular Serial #.  When you find a match, stop searching and export from the For Loop the Active Dev that matched your Device criteria (export it as a non-indexing Tunnel with a Conditional terminal, which would return a "blank" device if this fails).
  • Once you find the Active Device you want to use, you can use the same DAQmx Device Node to query the types of Physical Channels or other properties of the Device.
  • I think I learned how to do this by reading "Learn 10 Functions in NI-DAQmx ..." (type this into a Google search and it will find it after you type the first three words) a few times.  Ignore the initial discussion of the Dreaded DAQ Assistant.

Here's an example of creating a Task for some Flow Meters, where I wanted to scale the (voltage) input from the USB-6001 to L/m, specifying a Maximum Flow, and using a linear scale to give me Slope and Offset.  The first sub-VI ("Find DAQ Device") implements the points of the first two Bullet Points, and this sub-VI does the rest of the work of building a Task that takes 8 channels worth of data.

Create Flow Task.png

 

Bob Schor

0 Kudos
Message 2 of 4
(1,457 Views)

I think that you may have misunderstood my issue. Lets say that I am using a cDAQ chassis with 8 slots. In it, I have a voltage input card (9220), multiple thermocouple input cards (9213), and a current input card (9208). In my Labview program, I have a settings vi where there is a dropdown control, and I can select from it either voltage input, temperature input or current input. Now, the voltage input card can only do voltage, the thermocouple card can do voltage and temperature, and the current card can do current. So I am covered, in every situation, my pulldown menu, which controls a case structure, covers my possibilities.

 

But then one day, the customer shows up, and he has some PT100 sensors, and brings his own RTD input card (9217). The issue is that it only has two outputs, temperature:RTD and resistance. I do not have that option in my dropdown, because I only have cases for voltage, temperature and current. Ok, so then I could just make a new case for temperature:RTD, and then another for resistance. But then someone else needs strain measured, and then someone else needs frequency, and yet another is thinking about checking acceleration. At some point, it makes little sense to continue to keep making a new case for every single possible input type, and you start wondering if there isnt a way to have this selectable.

0 Kudos
Message 3 of 4
(1,452 Views)

Oops, I tried to answer the "wrong question".

 

But as you reformulate the question, it begins to sound like "The User plugs an Unspecified DAQ device into my PC, and wants to measure X (which the device supports).  How do I configure the Unspecified Device?  Well, you'd need (a) some way to identify the device (which I tried to show is do-able), and (b) you'd need to know enough about the device to be able tp know how to program to its capabilities.  

 

One way (and, perhaps at the present time, the only way) to handle this is to have a list of "possibilities" (such as all cDAQ plugins) and to use the information MAX/DAQmx provides to, at run time, choose the appropriate tests.  Hmm, beginning to sound like Objects and Plug-ins might be involved ...

 

Bob Schor

0 Kudos
Message 4 of 4
(1,448 Views)