Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

is there any function in DAQmx that servies similar as Get_DAQ_Device_Info?

Hi,
 
I am using DAQmx in VC++ without CVI or Measurement Studio. I would like to detect the card name when my app starts instead of using Dev1 as default. There is a function Get_DAQ_Device_Info in the traditional DAQ but I can't find a similar one in the DAQmx. Is there any way to get the card info in DAQmx?
 
Thanks.
David
0 Kudos
Message 1 of 7
(4,467 Views)

Hi David-

You can use

   DAQmxGetSysDevNames(char *data, uInt32 bufferSize);

to obtain a comma-delimited list of the devices installed in your system and then use

   DAQmxGetDevProductType(const char device[], char *data, uInt32 bufferSize); 

to return the device type (i.e. PCI-6251, etc).  There are also a number of other useful properties you can query for a device including I/O capabilities, serial number, etc.  These are all listed in the NI-DAQmx C Reference Help (Start>>National Instruments>>NI-DAQ) under NI-DAQmx C Properties>>List of Device Properties.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 2 of 7
(4,460 Views)
Thanks Tom, it really helps!
0 Kudos
Message 3 of 7
(4,448 Views)

Hi, Tom,

I tried the functions you suggested, but it seems not working well. Here is what I did:

 char data[256];
 DAQmxGetSysDevNames(data,256);
 int32 temp = DAQmxGetDevProductType("PCI-MIO-16E-1",data,256);

I guess the return value of DAQmxGetDevProductType could tell me something about the card. But the return value is always -20020. I also tried this way:

 char data[256];
 DAQmxGetSysDevNames(data,256);
 char device[256];
 DAQmxGetDevProductType(device,data,256);

And the device tell me nothing either. Since there is no examples and no detailed function explanation, would you please show me how to use this two functions to get the card name. If there is another card installed besides PCI-MIO-16E-1, say PCI-6251, how to know the name of each card?

Thank you very much!

David

Message Edited by RedGrouper on 06-14-2006 03:48 AM

0 Kudos
Message 4 of 7
(4,435 Views)
Hi David-
 
These lines should return the data you can use:
 
 char  devNames[256]={'\0'};
 char  testDevName[256]={'\0'};
 DAQmxErrChk (DAQmxGetSysDevNames(&devNames, 256)); 
 DAQmxErrChk (DAQmxGetDevProductType("Dev1", &testDevName, 256));
 
The DAQmxGetSysDevNames will return the names as they appear in MAX (Dev1, Dev2, etc).  The DAQmxGetDevProductType requires the device name to be the same as what you would see in MAX or returned by DAQmxGetSysDevNames.
 
So, on my system the first DAQmx call returns "Dev1, Dev2, Dev4" and the second returns "PCI-6251" (which is the device that is named Dev1 on my system).
 
Let me know if you have more questions-
Tom W
National Instruments
0 Kudos
Message 5 of 7
(4,425 Views)

Hi, Tom,

I've tested it and it woks. Thanks a lot!

David

0 Kudos
Message 6 of 7
(4,409 Views)
Hi David-
 
I'm glad I could help- let us know if you have any additional questions.
 
Thanks-
Tom W
National Instruments
0 Kudos
Message 7 of 7
(4,406 Views)