Keithley 708B Reference Manual page 86

Switching matrix
Hide thumbs Also See for 708B:
Table of Contents

Advertisement

Models 707B and 708B Switching Matrix Reference Manual
VISA-C sample code
The following is a simple C/C++ console application that reads back the instrument identification
string using VISA-C. You need to include visa.h and link with the visa32.lib file.
#include "stdafx.h"
#include <visa.h>
#define checkErr(fCall)
0) ? error : VI_SUCCESS)) \
int _tmain(int argc, _TCHAR* argv[])
{
ViSession defaultRM, vi;
char buf [256] = {0};
ViStatus
/* Open session to GPIB device at address 22 */
checkErr(viOpenDefaultRM(&defaultRM));
checkErr(viOpen(defaultRM, "GPIB0::14::INSTR", VI_NULL,VI_NULL, &vi));
/* Initialize device */
checkErr(viPrintf(vi, "*RST\n"));
/* Send an *IDN? string to the device */
checkErr(viPrintf(vi, "*IDN?\n"));
ViUInt16 status = 0;
do
{
checkErr(viReadSTB(vi, &status));
printf("ReadSTB = %X\n", status);
} while(status == 0);
/* Read results */
checkErr(viScanf(vi, "%t", &buf));
/* Print results */
printf ("Instrument identification string: %s\n", buf);
/* Close session */
checkErr(viClose(vi));
checkErr(viClose(defaultRM));
Error:
if(error < VI_SUCCESS)
printf("Visa Error Code: %X\n", error);
printf("\nDone - Press Enter to Exit");
getchar();
return 0;
}
707B-901-01 Rev. A / August 2010
if (error = (fCall), (error = (error <
{goto Error;}
error = VI_SUCCESS;
Section 2: General operation
else error = error
2-67

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

707b

Table of Contents