Agilent Technologies E2094S Uživatelská příručka Strana 45

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 146
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 44
Programming with VISA 3
Agilent VISA User’s Guide 45
/*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);
}
Zobrazit stránku 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 145 146

Komentáře k této Příručce

Žádné komentáře