Programming Manual UTG1000X Series
Instruments.uni-trend.com
36
/
51
*
parameters in this function are reserved for future
*
functionality. These two parameters are given the value VI_NULL. */
for (i = 0; i < int(numInstrs); i++)
{
if (i > 0)
{
viFindNext(findList, instrResourceString);
}
status = viOpen(defaultRM, instrResourceString, VI_NULL, VI_NULL, &instr);
if (status < VI_SUCCESS)
{
printf("Cannot open a session to the device %d. \n", i + 1);
continue;
}
/** At this point we now have a session open to the USB TMC instrument.
*We will now use the viPrintf function to send the device the string "*IDN?\n",
*asking for the device’s identification. */
char * cmmand = "*IDN?\n";
status = viPrintf(instr, cmmand);
if (status < VI_SUCCESS)
{
printf("Error writing to the device %d. \n", i + 1);
status = viClose(instr);
continue;
}
/** Now we will attempt to read back a response from the device to
*the identification query that was sent. We will use the viScanf
*function to acquire the data.
*After the data has been read the response is displayed. */
status = viScanf(instr, "%t", buffer);
if (status < VI_SUCCESS)
{
printf("Error reading a response from the device %d. \n", i + 1);
}
else
{
printf("\nDevice %d: %s\n", i + 1, buffer);
}
status = viClose(instr);
}
/*Now we will close the session to the instrument using viClose. This operation frees all
system resources.*/
status = viClose(defaultRM);
printf("Press Enter to exit.");