Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DAQmxGetDevProductNum and DAQmxGetDevProductCategory?

Hi,
 
I added this two functions in my C++ code as

 uInt32 ProductNum,ProductCat;
 DAQmxGetDevProductNum("Dev1",&ProductNum);
 DAQmxGetDevProductCategory("Dev1",&ProductCat);

but there are errors from the compiler that

error C3861: 'DAQmxGetDevProductNum': identifier not found
error C3861: 'DAQmxGetDevProductCategory': identifier not found
Do I need to include any header file for these two functions other than NIDAQmx.h? Is there another way to realize these two functions in DAQmx v8.1?
 
Thank you very much!
David
0 Kudos
Message 1 of 13
(6,549 Views)

Hi David,

You have to include NiDAQmx.lib in C++ environment. For complete list of settings, please refer to this knowledge base:

http://digital.ni.com/public.nsf/websearch/0087C1E20920F7B986256D9B0061DEE2?OpenDocument

Please let me know if this helps.

Thanks,

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 2 of 13
(6,538 Views)

Hi, Kalyan,

I have already included both NiDAQmx.lib  and NiDAQmx.h in my project by right-clicking on the source files, and selecting Add» Add Existing Item. The problem still exists. Is it the correct way to add the library files?

Thanks.

David 

0 Kudos
Message 3 of 13
(6,530 Views)
Hi David,
 
Can you please post your project with simple code demonstrating the problem. It will be helpful to debug the issue using the sample project.
 
Thanks,
Kalyan
Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 4 of 13
(6,509 Views)
Hi, Kalyan,
 
I attached a sample project for you. In the CheckNIcard function in DAQmx.cpp, I tried to use DAQmxGetDevProductNum and DAQmxGetDevProductCategory, but the compile error appeared. Please help me check what's wrong.
 
Thank you very much!
David
0 Kudos
Message 5 of 13
(6,508 Views)

Hi David,

These are the steps I would follow to fix your code:

Click the Directories tab. Make sure you are viewing the directories for include files, and add the following new path: C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include.

Add a link for library files with the following path: C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc.

After you add NIDAQmx.lib and NIDAQmx.h, the code should compile without problems.

Thanks,

 

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 6 of 13
(6,489 Views)

Hi David,

Forgot to mention that attached zip file has example code which I created to show you as how to get the list of devices in a computer using VC++ and DAQmx.

Thanks,

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 7 of 13
(6,486 Views)
Hi, Kalyan,
 
Thanks for your code. I still have some questions.
1) the functions DAQmxGetSystemInfoAttribute and DAQmxGetDeviceAttribute could not be found in the NI-DAQmx C Reference Help. Can you tell me where they are introduced?
2) I did as what you told me to select Tools -> Options, select Projects->VC++ Directories, add the path: C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include, and C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc. But there are still the same compile errors.
 
Any suggestion?
David
0 Kudos
Message 8 of 13
(6,482 Views)

Hi, Kalyan,

In some posts it was said that DAQmxGetSystemInfoAttribute and DAQmxGetDeviceAttribute is for CVI only. And in DAQmx C, I have to use DAQmxGetDevProductType and DAQmxGetDevSerialNum. If it is true, would you please provide any code with DAQmx C, not CVI, to enumerating devices?

Thank you very much!

David

0 Kudos
Message 9 of 13
(6,481 Views)

Hi David,

Sorry for the confusion. What I was referring to is:

Add the following files to your project;

1) C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc\NIDAQmx.lib 

2) C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h

If you don't add the library file, you will get the linking errors. Please refer to the sample project I posted as how the following files have been added to project.

In the code I have posted for VC++, I used DAQmxGetSystemInfoAttribute for getting the list of devices. Then I poupulated the properties of each device using DAQmxGetDevProductType and DAQmxGetDevSerialNum.

The code I posted should answer most of the questions.

Thanks,

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 10 of 13
(6,465 Views)