03-13-2015 02:15 PM
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
Solved! Go to Solution.
03-13-2015 03:06 PM
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
03-13-2015 05:28 PM
03-13-2015 06:26 PM
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.
03-13-2015 06:39 PM
03-15-2015 05:02 PM
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