EasyManua.ls Logo

Anritsu LMR Master S412E - Page 664

Anritsu LMR Master S412E
704 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
A-1 C/C++ Example
A-2 PN: 10580-00319 Rev. N S412E PM
if (status < VI_SUCCESS)
{
/* Error Initializing VISA...exiting*/
printf(”Can't initialize VISA\n”);
return –1;
}
/* Open communication with TCP/IP device at xxx.xxx.xxx.xxx*/
/* NOTE: For simplicity, we will not show error checking*/
/* TODO: Add error handling. */
status = viOpen(defaultRM, pAddress, VI_NULL, VI_NULL, &instr);
/* Set the timeout for message-based communication*/
/* TODO: Add error handling. */
status = viSetAttribute(instr, VI_ATTR_TMO_VALUE, 120000);
/* Ask the device for identification */
sprintf(buffer, “*IDN?\n”);
status = viWrite(instr, (unsigned char *)&buffer[0], 6, &retCount);
status = viRead(instr, (unsigned char *)buffer, BUFFER_SIZE,
&retCount);
/* TODO: Add code to process data. */
strncpy(tempDisplay, buffer, retCount);
tempDisplay[retCount] = 0; /* Null-terminate display string. */
printf(”*IDN? Returned %d bytes: %s\n”, retCount, tempDisplay);
/* Close down the system */
/* TODO: Add error handling. */
status = viClose(instr);
status = viClose(defaultRM);
return 0;
}

Table of Contents

Related product manuals