A-1 C/C++
{
printf("Usage: IdnExample
\"USB0::0x0B58::0xFFF9::xxxxxxxx_xxx_xx::INSTR");
printf("\t where xxxxxxxx_xxx_xx is the USB Device ID of your
instrument.\n");
return -1;
}
/* Store the address. */
pAddress = argv[1];
/* Begin by initializing the system*/
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
/* Error Initializing VISA...exiting*/
printf("Can't initialize VISA\n");
return -1;
}
/* USB0::0x0B58::0xFFF9::xxxxxxxx_xxx_xx::INSTR*/
/* 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. */
A-2
PN: 10580-00322 Rev. F
Appendix A — Examples
S331L PM
Need help?
Do you have a question about the Site Master S331L and is the answer not in the manual?