Agilent Technologies E2094S User Manual page 45

For io libraries suite 15.5
Table of Contents

Advertisement

Agilent VISA User's Guide
/*nonfmtio.c
This example program measures the AC voltage on
a multimeter and prints the results. You may
need to change the device address. */
#include <visa.h>
#include <stdio.h>
void main () {
ViSession defaultRM, vi;
char strres [20];
unsigned long actual;
/* Open session to GPIB device at address 22 */
viOpenDefaultRM(&defaultRM);
viOpen(defaultRM, "GPIB0::22::INSTR",
VI_NULL,VI_NULL, &vi);
/* Initialize device */
viWrite(vi, (ViBuf)"*RST\n", 5, &actual);
/* Set up device and take measurement */
viWrite(vi, (ViBuf)"CALC:DBM:REF 50\n", 16,
&actual);
viWrite(vi, (ViBuf)"MEAS:VOLT:AC? 1, 0.001\n",
23, &actual);
/* Read results */
viRead(vi, (ViBuf)strres, 20, &actual);
/* NULL terminate the string */
strres[actual]=0;
/* Print results */
printf("Measurement Results: %s\n", strres);
/* Close session */
viClose(vi);
viClose(defaultRM);
}
Programming with VISA
3
45

Advertisement

Table of Contents
loading

Table of Contents