Agilent Technologies E2094S Podręcznik Użytkownika Strona 43

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 146
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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);
}
Przeglądanie stron 42
1 2 ... 38 39 40 41 42 43 44 45 46 47 48 ... 145 146

Komentarze do niniejszej Instrukcji

Brak uwag