11-15-2011 01:36 PM
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
Solved! Go to Solution.
11-16-2011 06:08 PM
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
11-17-2011 11:21 AM
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:
but I tried the "NI-USB-6501" just in case.
So, no go for the time being.
thanks for your help,
Andrzej
11-17-2011 02:01 PM
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 | |||
) |
11-17-2011 03:29 PM
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
11-17-2011 03:29 PM
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
11-17-2011 03:34 PM
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
11-17-2011 03:50 PM
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
11-23-2011 01:58 PM
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
01-02-2012 09:15 AM
hello
Can I connect 4 cards 6518 to one office PC
please any one can help me
thank you for the help