49 User Manual
EAR99 technology subject to restrictions on copyrights page.
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 try to read back the response of a device information query
from the device. We will use the viScanf function to get the data. After the
data is read out, 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,retCount,
buffer); status = viClose (instr);
}
/** We will now close the session using the viClose instrument. This action
frees up all system resources */
Return 0
}
•
Based on the LAN port code Write a TCP_IP_Test function.
int TCP_IP_Test (char * pIP) {
char outputBuffer[VI_FIND_BUFLEN];
ViSession defaultRM,
instr; ViStatus status;
ViUInt32 count;
ViUInt16 portNo;
status = viOpenDefaultRM
(&defaultRM); if (status <
VI_SUCCESS)
{
printf("Could not open a session to the VISA Resource
Manager!\n");
}
char head[256] ="TCPIP0::"; char tail[] ="::INSTR";
char resource [256]; strcat(head,pIP); strcat(head,tail);