Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Alias vs. "Dev1" in NI-DAQmx Base

Using C++ with VISA and NI-DAQmx Base v1.4, how can I detect what I should address a connected device by when creating tasks ala "Dev1/ai0"?

The NI-DAQmx version of the interface I'm writting just used DAQmxGetSysDevNames to just easily but, sadly, that function doesn't seem to have a NI-DAQmx Base equivilent.

I've used VISA to detect the long name ("USB0::...") and the alias ("Bob", "DoohickeyOnMyDesk" or whatever) but they don't seem to work. So how do I discover "Dev1" or whatever it is for the particular user's device that I need for the channel string?
0 Kudos
Message 1 of 12
(3,987 Views)
I have the same problem in LabView i would like to use the visa information to detect but that seems to be a problem.
0 Kudos
Message 2 of 12
(3,959 Views)
There is a program that installs with NI-DAQmx Base that will list all DAQmx Base devices. In windows, it is called DAQmx Base List Devices. In Mac and Linux, it is called lsdaq. If you are curious about finding out devices present programmatically, there really isn't a great way to do this. One solution that several customers have used in the past is to loop through several device numbers calling a function like DAQmxBase Reset Device, then look at the error code returned. If the device number doesn't return an error, then the device number is valid. Again, this isn't an ideal solution, but it works.
-Alan A.
0 Kudos
Message 3 of 12
(3,962 Views)
This brings up an obvious question: how does lsdaq do it?
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 12
(3,948 Views)
If you are curious about finding out devices present programmatically, there really isn't a great way to do this.

So I've noticed, with great sadness and moderate frustration. 😉

The List Devices utility you mentioned turned out to be pretty handy when used with NI Spy. I tried that first and was able to figure out how to get the alias pretty easily by accessing an undocumented attribute but I didn't see anything obvious that indicated "Dev1" was the device name even though it was displayed as such. Can a user change that name to anything they want like with DAQmx devices or will it always be "Dev-"?
0 Kudos
Message 5 of 12
(3,946 Views)
I am not aware of any way to change the device name in NI-DAQmx Base. I believe this to be a limitation of Base.
-Alan A.
0 Kudos
Message 6 of 12
(3,923 Views)
If that's the case then that would actually be helpful because I could do the name looping you described with Dev1 through X. Still, I hope mxBase v1.5 has DAQmxBaseGetSysDevNames implemented. 😉 Thanks for the tips, I think I'll be able to work this out now.
0 Kudos
Message 7 of 12
(3,919 Views)
If anyone is intersted, here is a LabVIEW VI that lists all NI-DAQmx Base devices programmatically.
-Alan A.
0 Kudos
Message 8 of 12
(3,884 Views)


@Alan A. wrote:
If anyone is intersted, here is a LabVIEW VI that lists all NI-DAQmx Base devices programmatically.
-Alan A.




Very interesting, Alan. I don't use Labview; can you describe what your VI does? Would it be difficult to implement it using the DAQmx Base C API?
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 9 of 12
(3,871 Views)
John,
The answer is yes, it would be extremely difficult (probably impossible) to implement this with the C API. As you probably know, NI-DAQmx Base is written in LabVIEW, and this program uses quite a few VIs that do not have C API function equivalents. A possibility would be to build a dll from the LabVIEW program and call that dll from your C program.
-Alan A.
0 Kudos
Message 10 of 12
(3,841 Views)