Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to enumerate devices by AI/AO properties ?

Solved!
Go to solution

I asked this in the CVI forum yesterday, but there's probably more people who know NIDAQmx here.

 

Rationale: I'd like to program my app to use whatever AI and AO it can find on a CompactDAQ chassis. It's the 4th upgrade of this app in 20 years and I'd like to leave the possibility to change the hardware without having to recompile.

 

So I saw AQmxGetSystemInfoAttribute (DAQmx_Sys_DevNames) which gives me a list of connected NI devices.

Great, I can parse that.

 

But then I wanted to know which ones are analog input and which are analog output.

I first looked at DAQmxGetChanAttribute (Task, Channel, DAQmx_ChanType, &Type) but you need to have already defined the channels yourself... Useless.

 

Then I looked at NISysCfgGetResourceIndexedProperty() but I don't see any property that will list the available channels and tell me if it's AI or AO.

 

How is that possible ? Am I overlooking some obvious function call ?

 

 Thanks

0 Kudos
Message 1 of 6
(4,290 Views)

 

Dunno what kinds of function calls are needed from CVI, but in LabVIEW there's a thing called a "DAQmx Device Property Node" which has a series of cascading menus from which to query dozens of different kinds of device properties and characteristics.

 

In case you have access to LabVIEW 2013 or newer, here's a snippet.  (Drag and drop the png file onto a LabVIEW block diagram and voila!  it recreates the code.)   There's a lot built into this one node and I suspect it'd take a whole family of function calls in CVI to replicate it.

 

 

-Kevin P

 

 

 device io capabilities.png

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 6
(4,283 Views)
The same properties are available with cvi but your question is backwards. You don't query a channel to see if it is input or output. You query for devices and then get the number of analog input channels or analog output channels of each device.
0 Kudos
Message 3 of 6
(4,270 Views)

Fine... but how do you do that ? I can't find a function to do this, and I just looked at the entire DAQmx tree of function calls.

0 Kudos
Message 4 of 6
(4,264 Views)
I don't have cvi at this time but the properties should be very similar to what is shown in the above image. From the property that you've already found, don't you get s list of devices? Don't you see multiple properties listed under device?
0 Kudos
Message 5 of 6
(4,261 Views)
Solution
Accepted by topic author gdargaud

Thanks, I finally found it by looking at the header file as those functions are not all in the function panel:

 

DAQmxGetSystemInfoAttribute (DAQmx_Sys_DevNames,    Str, 255);

cDAQ9184-19E4514, cDAQ9184-19E4514Mod1, cDAQ9184-19E4514Mod2

 

To get the list of devices. And then for each device:

 

DAQmxGetDevAOPhysicalChans(Channel, Str, 255);
cDAQ9184-19E4514Mod1/ao0, cDAQ9184-19E4514Mod1/ao1, cDAQ9184-19E4514Mod1/ao2, cDAQ9184-19E4514Mod1/ao3

DAQmxGetDevAIPhysicalChans(Channel, Str, 255);

cDAQ9184-19E4514Mod2/ai0, cDAQ9184-19E4514Mod2/ai1, cDAQ9184-19E4514Mod2/ai2, cDAQ9184-19E4514Mod2/ai3

0 Kudos
Message 6 of 6
(4,230 Views)