07-13-2012 02:39 AM
Hi,
I've written a smal Daqmx-Application for Excel in VBA. Is it possible to get device information about the connected Daq-device? I need to know how many channels the device has in order to enable or disable some functionality of my programm.
With kind regards,
Alex
07-13-2012 03:07 AM - edited 07-13-2012 03:07 AM
I've found the solution with DAQmxGetDevAIPhysicalChans. One more question How do I have to use the function?
At the moment I tyry the following
Dim tmpStr As String
Dim tmp As Integer
tmp = DAQmxGetDevAIPhysicalChans("Dev1", tmpStr, 0)
But I only get a 79 in tmp and an empty tmpstr. Is the something I have to do first? Is 0 for the buffersize okay? What for do I need the buffersize when I ask for physical chanels? I have a USB 6009 Card
Greatings,
Alex
07-16-2012 10:07 AM
Hi Alex,
the command DAQmxGetDevAIPhysicalChans can be used to show all available AI channels from the device.
DAQmxGetDevAIPhysicalChans(const char device[], char *data, uInt32 bufferSize);
1.The first parameter of the function is a character array (string-array) where you have to transfer the devicename,e.g. "Dev1"
2. The 2nd one is the output value which is also a character array, this is array shows all AI channels
3. buffer size is an integer value, the number specifies the length of the output value array
char result[20000];
int size = 50;
....
DAQmxGetDevAIPhysicalChans("Dev1", result, size);
Please make sure for basic testing that only one Device exist. Otherwise the function won't work, because an arry of devices is transmitted -
if this happes you need a for-loop around the function;
Kind regards,
Rupert Donauer,
NIG AE
07-17-2012 03:53 AM
Hey Rupert,
Thank you for your reply.
When I use the function, the intellisens says, that the function expects device as a string, result as a string and buffer as an integer. By the way, there is no char in VBA as far as I know. So I do this:
Dim result as String
Dim dummy as Long
dummy = DAQmxGetDevAIPhysicalChans("Dev1", result, 50)
Then the result is "" (empty) and dummy is 79. I'm a bit desperate with this problem. What does 79 mean?
Do you have another idea?
Regards, Alex
07-17-2012 08:04 AM
Hi Alex,
I carried out the functin in LabWindows CVI ( ANSI C development from NI).
I'm not involed in VBA.
Check if the dummy parameter is required, in CVI the command:
...
DAQmxGetDevAIPhysicalChans("Dev1", result, 50);
...
was allright.
Kind regards,
Rupert
Rupert