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

  • 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 42
Programming with VISA 3
Agilent VISA User’s Guide 43
Example: Sending and Receiving Formatted I/O The following
C sample program demonstrates sending and receiving formatted I/O.
The program opens a session with a GPIB device and sends a comma
operator to send a comma-separated list. This program shows specific
VISA functionality and does not include error trapping.
This example program is installed on your system in the
ProgrammingSamples subdirectory.
/*formatio.c
This example program makes a dmm measurement
with a comma-separated list passed with
formatted I/O and prints the results. You may
need to change the device address. */
#include <visa.h>
#include <stdio.h>
void main () {
ViSession defaultRM, vi;
double res;
double list [2] = {1,0.001};
/* Open session to GPIB device at address 22*/
viOpenDefaultRM(&efaultRM);
viOpen(defaultRM, "GPIB0::22::INSTR",
VI_NULL,VI_NULL, &vi);
/* Initialize device */
viPrintf(vi, "*RST\n");
/* Set-up device,send comma-separated list */
viPrintf(vi, "CALC:DBM:REF 50\n");
viPrintf(vi, "MEAS:VOLT:AC? %,2f\n", list);
/* Read results */
viScanf(vi, "%lf", &res);
/* Print results */
printf("Measurement Results: %lf\n", res);
/* Close session */
viClose(vi);
viClose(defaultRM);
}
Zobrazit stránku 42
1 2 ... 38 39 40 41 42 43 44 45 46 47 48 ... 145 146

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

Žádné komentáře