Agilent Technologies PSG Instrukcja Obsługi Strona 51

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 362
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 50
Programming Examples
GPIB Programming Examples
Chapter 2 37
Interface Check using VISA and C
This program uses VISA library functions and the C language to communicate with the signal
generator. The program verifies that the GPIB connections and interface are functional.
Launch Microsoft Visual C++ 6.0, add the required files, and enter the following code into
your .cpp source file.
The following program example is available on the PSG Family Documentation CD-ROM as
visaex1.cpp.
//****************************************************************************************
// PROGRAM NAME:visaex1.cpp
//
// PROGRAM DESCRIPTION:This example program verifies that the GPIB connections and
// and interface are functional.
// Turn signal generator power off then on and then run the progam
//
//****************************************************************************************
#include <visa.h>
#include <stdio.h>
#include "StdAfx.h"
#include <stdlib.h>
void main ()
{
ViSession defaultRM, vi; // Declares a variable of type ViSession
// for instrument communication
ViStatus viStatus = 0;
// Opens a session to the GPIB device
// at address 19
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM, "GPIB::19::INSTR", VI_NULL, VI_NULL, &vi);
if(viStatus){
printf("Could not open ViSession!\n");
printf("Check instruments and connections\n");
printf("\n");
exit(0);}
viPrintf(vi, "*RST\n"); // initializes signal generator
// prints to the output window
printf("The signal generator should now be in REMOTE. The remote
indicator\n");
printf("annunciator R should appear on the signal generator display\n");
printf("\n");
viClose(vi); // closes session
viClose(defaultRM); // closes default session
}
Przeglądanie stron 50
1 2 ... 46 47 48 49 50 51 52 53 54 55 56 ... 361 362

Komentarze do niniejszej Instrukcji

Brak uwag