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