Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

List devices in DAQmxBase (using the C library)

 Hello,

 

I'm trying to port one of my programs from DAQmx on Windows to DAQmxBase on Linux. However, I did not succeed in getting a list of connected devices using DAQmxBase.

On Windows, I would simply do DAQmxGetSysDevNames(), but this function is not available in DAQmxBase.

 

Next step was to use the daqmxbase_listdevices_so.so and the function daqmxbase_listdevices(). This function returns only 0 for me.

 

Any other hints?

0 Kudos
Message 1 of 12
(6,602 Views)

Hello Mauritzius,

 

Thank you so much for your post on our webforum. There are some DAQmx driver versions for the different Linux builds. You can download these drivers through this link .

 

I came across this post, from which we can conclude it isn't possible to read those properties with the DAQmx base driver. So I'm hoping the DAQmx for Linux can help you further.

 

Please let me know if you have any further questions,

 

Best regards,

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 2 of 12
(6,592 Views)

Thank you for your answer. Unfortunately, I'm using a USB-Device (NI 6211) that is only supported by the DAQmxBase driver.

 

I'm also not quite sure on how to proceed, maybe I'll drop Linux support entirely. Since my application is in fact written in Python, I ran into the same Null-Pointer/TaskHandle problems reported in the forum (just can't find the thread right now).

0 Kudos
Message 3 of 12
(6,585 Views)
You may want to look into doing lower-level calls to detect your device. DAQmx Base uses VISA to detect and communicate with the devices, so why not do the same?

The simplest way to detect attached DAQ devices on the system is with viFindRsrc() [1], which returns all of the resources with which VISA can interact. Note, however, that this call will return more devices than what the CLI utility lsdaq will return since VISA can also interact with serial ports and other buses (eg GPIB). The plus side, though, is that the string that VISA returns matches the string that lsdaq returns for the same type of device. The lsdaq utility then matches the hex VID and PID to a model name and displays that as well.

lsdaq implements its own viFindRsrc(), but since the driver still uses VISA to discover devices, the order that VISA finds and returns devices is the order that lsdaq uses to name devices. In other words, the first device that VISA finds which is supported by DAQmx Base is called Dev1, the second is called Dev2, and so on. So, once you get the resource list from viFindRsrc(), you only need to count supported DAQ devices found and then match the VID and PID to detect which NI USB DAQ device is connected. More concretely, the KnowledgeBase has an article that gives an example of USB device detection in VISA [2]. In that example, the VID is 0x046D and the PID is 0xC01A. On Linux, you can use lsdaq or lsusb to learn the VID and PID for your devices.

VISA installs with DAQmx Base, so it is already on your system. The root folder for user programing is /usr/local/vxipnp/linux/NIvisa/, and there is a shipping example that shows how to use viFindRsrc() in Examples/C/General/FindRsrc.c. Meld that code with your DAQmx Base calls, and you'll be all good to go 🙂

[1] NI-VISA Help
http://digital.ni.com/manuals.nsf/websearch/F18AFBCF54BF133A862574CE004B9B97

[2] Identifying Multiple Identical USB Raw Devices with NI-VISA
http://digital.ni.com/public.nsf/allkb/83E8674ABD22BB7D862575DF0054D5BC?OpenDocument
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Message 4 of 12
(6,581 Views)

"VISA installs with DAQmx Base, so it is already on your system. The root folder for user programing is /usr/local/vxipnp/linux/NIvisa/, and there is a shipping example that shows how to use viFindRsrc() in Examples/C/General/FindRsrc.c."

 

I am running on an OpenSUSE 11.3 linux system using NIDAQmsBase v3.5

 

I can see the /usr/local/vxipnp/linux/NIvisa/Examples/C/FindRsrc.c file, but when I go to make it using your Makefile in Examples.C, I get an error saying that it is skipping /usr/local/lib/libvisa.so and then another error (obviously) that says it cannot find -lvisa

 

Any thoughts?

 

thanks

 

Gregg

0 Kudos
Message 5 of 12
(5,327 Views)

GreggSAO wrote:

 

I am running on an OpenSUSE 11.3 linux system using NIDAQmsBase v3.5

 

I can see the /usr/local/vxipnp/linux/NIvisa/Examples/C/FindRsrc.c file, but when I go to make it using your Makefile in Examples.C, I get an error saying that it is skipping /usr/local/lib/libvisa.so and then another error (obviously) that says it cannot find -lvisa

 

Any thoughts?


I think I need more detail, since I cannot reproduce your problem:

 

rlpbuilder@rlplinbuild :: Tue, 01 May 2012 10:52:22
/usr/local/vxipnp/linux/NIvisa/Examples/C
$ make
gcc -ansi -O1 -D_REENTRANT -I ../../../include -c GPIB/AsyncIO.c -o GPIB/AsyncIO.o
gcc  GPIB/AsyncIO.o -lvisa -lc -lpthread -o GPIB/AsyncIO
gcc -ansi -O1 -D_REENTRANT -I ../../../include -c GPIB/AsyncSRQ.c -o GPIB/AsyncSRQ.o
gcc  GPIB/AsyncSRQ.o -lvisa -lc -lpthread -o GPIB/AsyncSRQ
gcc -ansi -O1 -D_REENTRANT -I ../../../include -c VXI-VME/AsyncIntr.c -o VXI-VME/AsyncIntr.o
gcc  VXI-VME/AsyncIntr.o -lvisa -lc -lpthread -o VXI-VME/AsyncIntr
gcc -ansi -O1 -D_REENTRANT -I ../../../include -c General/FindRsrc.c -o General/FindRsrc.o
gcc  General/FindRsrc.o -lvisa -lc -lpthread -o General/FindRsrc
gcc -ansi -O1 -D_REENTRANT -I ../../../include -c VXI-VME/HighReg.c -o VXI-VME/HighReg.o
gcc