LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Device information

Using LabWindows/CVI how can I get the number of channels available for AI and AO on a device. I can find where to get the names of the installed devices but I don't see how to get subsequent specific information about the device. I've seen this question asked several times before yet I've not seen anyone answer it.
 
Thanks, Tom
0 Kudos
Message 1 of 3
(3,050 Views)
Hi Tom,

I think what you're after is DAQmxGetDeviceAttribute.  Among the many attibutes you can query are the names of the various physical channels on the device.  As you mentioned, you can use DAQmxGetSystemInfoAttribute to get the names of the devices on your system, then use the names to get the physical AI or AO channels.  The code below shows you exactly how this is done:

char devNamesBuffer[NAMES_BUF_SIZE]; /* Define NAMES_BUF_SIZE and CHAN_BUF_SIZE */
char channelsBuffer[CHAN_BUF_SIZE];  /* as some reasonable constant */
char *currentDev, *remainingDevs, *currentChan, *remainingChans;

DAQmxGetSystemInfoAttribute (DAQmx_Sys_DevNames, devNamesBuffer, NAMES_BUF_SIZE);

currentDev = devNamesBuffer;

while(currentDev)
{
    if(remainingDevs = strchr(currentDev, ','))
    {
        *remainingDevs= '\0'; /* Separate the item from the rest of the string */
        remainingDevs+= 2;    /* Increment past the comma and space delimiters */
    }

    /* Use
DAQmx_Dev_AI_PhysicalChans and DAQmx_Dev_AO_PhysicalChans */
    /* to get analog input and analog output channels, respectively  */
    DAQmxGetDeviceAttribute (currentDev, DAQmx_Dev_AI_PhysicalChans,
        channelsBuffer, CHAN_BUF_SIZE);

    currentChan = channelsBuffer;
   
    while(currentChan)
    {
        if(remainingChans = strchr(currentChan , ','))
        {
            *remainingChans = '\0';
            remainingChans += 2;
        } 
       ...       /* Do something with currentChan */
       currentChan = remainingChans;
    }

    currentDev = remainingDevs;
}


Good luck.  I hope this helps you out.

Mert A.
National Instruments

Message 2 of 3
(3,028 Views)
Thank, you much. That is exactly what I needed.
 
0 Kudos
Message 3 of 3
(3,006 Views)