Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

list devices in ni-daqmx Dev1 in c

Solved!
Go to solution

Hi,

I'm trying to control multiple USB 6501 devices devices from a linux machine using standard C. I would basically like to be able to get the output of lsdaq in the code, i.e. to associate the serial number with the Dev1,Dev2,...names.

 

I have looked at the:

vxipnp/linux/NIvisa/Examples/C/General/FindRsrc.c 

and this works however it only gives me the following string:

USB0::0x3923::0x718A::015C400E::RAW

 

whereas lsdaq looks like:

NI USB-6501: "Dev1"    (USB0::0x3923::0x718A::015C400E::RAW)

 

so, as I said, I'm missing the Dev1 - serial number connection.

If the devices were discovered by the visa methods in the same order as in lsdaq, I guess I could hardcode it, but they're not. Also I would probably prefer using nidaq-mx(-base) methods to do this if they exist.

 

thanks,

Andrzej

 

 

0 Kudos
Message 1 of 11
(8,294 Views)

Hi Andrzejsz, 

 

I came across this command from another forum:

 

In C, we can use "Get/Set/Reset Dev_ProductNum" to get the device product number.

int32 __CFUNC DAQmxGetDevProductNum(const char device[], uInt32 *data);

For USB 6211

 

Device ID

Device Name

0x7270

NI USB-6211

 

This is for DAQmx (and not base) but I will do more research and see what else I can come up with for DAQmx-base. Is this on the right track? So far I haven't found any specific DAQmx-base command for device name.

 

Keep me posted with any further developments.

 

Courtney L

Applications Engineer

National Instruments

 

0 Kudos
Message 2 of 11
(8,276 Views)

Hi Courtney,

thanks for your reply. I think I could use Daqmx - at least other parts of my code compile.

Anyway, I tried the function you suggested:

 

 

 id11=DAQmxGetDevProductNum("NI USB-6501", &id1);
 id21=DAQmxGetDevProductNum("Dev2", &id2);
 id31=DAQmxGetDevProductNum("Dev3", &id3);

 printf("ids found: %d , %d, %d \n",id1,id2,id3);
 printf("ids found, hex: %x , %x, %x \n",id1,id2,id3);

 

I get:

 

ids found: 0 , 0, 0
ids found, hex: 0 , 0, 0

 

When I try lsdaq, I get:

Detecting National Instruments DAQ Devices
Found the following DAQ Devices:
NI USB-6501: "Dev1"    (USB0::0x3923::0x718A::015C400E::RAW)
NI USB-6501: "Dev2"    (USB0::0x3923::0x718A::01646B0B::RAW)
NI USB-6501: "Dev3"    (USB0::0x3923::0x718A::01646C0A::RAW)

 

 

I tried using "DevX" names, because that's the syntax I found here:

http://forums.ni.com/t5/Multifunction-DAQ/How-to-use-DAQmxGetDevProductNum-and-DAQmxGetDevProductCat...

 

but I tried the "NI-USB-6501" just in case.

So, no go for the time being.

thanks for your help,

Andrzej

 

 

0 Kudos
Message 3 of 11
(8,269 Views)

I found another function, which I think in principle should do exactly what I want it to (below),

however this still gives zeroes in the second parameters. If I were able to get this one working this would solve my problem.

The problem is I can't find a description of any of these functions in the .html documentation provided with the NI install CD.

Andrzej

 

 

int32 __CFUNC DAQmxGetDevSerialNum ( const char  device[],
    uInt32 data  
 

)

0 Kudos
Message 4 of 11
(8,263 Views)
Solution
Accepted by topic author Andrzejsz

Ok. I went back, looked through the NIDAQmxBase.h

and found:

DAQmxBaseGetDevSerialNum(const char[], uInt32 *);

 

this works for me, i.e. if I assume the total number of boards I can retrieve their serial numbers and work with that.

It would be nice if there was at least a hint of this function in

/usr/local/natinst/nidaqmxbase/documentation/

 

Andrzej

0 Kudos
Message 5 of 11
(8,254 Views)

Hey Andrzejsz,

 

I'm worried about your compatibility with DAQmx. You're using Linux with NI USB devices, correct? From what I can tell that shouldn't be compatibile with DAQmx. Take a look at this link: 

 

http://zone.ni.com/devzone/cda/tut/p/id/3695#toc0

 

If this isn't the problem I will definitely keep digging for documentation! 

 

Courtney L

Applications Engineer

National Instruments

 

 

 

0 Kudos
Message 6 of 11
(8,252 Views)

Hi Courtney,

thanks for your reply. Indeed I was using nidaqmx-base before and only switched to nidaqmx to test your suggestion. I have found a solution using nidamx-base (see above), so you needn't worry about looking for further documentation.

thanks,

Andrzej

0 Kudos
Message 7 of 11
(8,247 Views)

Hey,

 

Great -- glad you solved it! I didn't see your post before refreshing my page :). Yes - as a fellow DAQmx-base user (mac) I agree the documentation could be better. I'll put in a request on my end to alert the team to the problem!

 

Courtney

0 Kudos
Message 8 of 11
(8,245 Views)

Hi there,

 

I wanted to let you know I filed a request to have this documentation looked at so hopefully it will be improved for future users.

 

Thanks for bringing this to our attention!

 

Courtney L.

Applications Engineer

National Instruments

 

0 Kudos
Message 9 of 11
(8,198 Views)

hello 

 

Can I connect 4 cards 6518 to one office PC 

 

please any one can help me

 

thank you for the help

0 Kudos
Message 10 of 11
(8,060 Views)