EasyManuals Logo

Agilent Technologies EMC Series Programmer's Guide

Agilent Technologies EMC Series
349 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #99 background imageLoading...
Page #99 background image
Chapter 3 99
Programming Examples
C Programming Examples using VTL
Example Program
This example program queries a GPIB device for an identification string and prints
the results. Note that you must change the address if something other than the
EMC default value of 18 is required.
/*idn.c - program filename */
#include "visa.h"
#include <stdio.h>
void main ()
{
/*Open session to GPIB device at address 18 */
ViOpenDefaultRM(&defaultRM);
ViOpen(defaultRM, GPIB0::18::INSTR, VI_NULL,
VI_NULL, &vi);
/*Initialize device */
viPrintf(vi, *RST\n);
/*Send an *IDN? string to the device */
printf(vi, *IDN?\n);
/*Read results */
viScanf(vi, "%t", &buf);
/*Print results */
printf(Instrument identification string: %s\n, buf);
/* Close the sessions */
viClose(vi);
viClose(defaultRM);
}
Including the VISA Declarations File
For C and C++ programs, you must include the visa.h header file at the
beginning of every file that contains VTL function calls:
#include visa.h
This header file contains the VISA function prototypes and the definitions for all
VISA constants and error codes. The visa.h header file includes the
visatype.h header file.

Table of Contents

Other manuals for Agilent Technologies EMC Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies EMC Series and is the answer not in the manual?

Agilent Technologies EMC Series Specifications

General IconGeneral
BrandAgilent Technologies
ModelEMC Series
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals