EasyManuals Logo

Agilent Technologies E7401A Programmer's Guide

Agilent Technologies E7401A
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 #152 background imageLoading...
Page #152 background image
152 Chapter 3
Programming Examples
Status RegisterDetermine When a Measurement is Done
/* Make sure it is an SRQ event, ignore if stray event*/
if (eventType!=VI_EVENT_SERVICE_REQ)
{
printf ("\n Stray event type0x%1x\n",eventType);
/*Return successfully*/
return VI_SUCCESS;
}
/* When an interrupt occurs,determine which device generated the interrupt
(if an instrument other than the ESA generates the interrupt, simply report
"Instrument at GPIB Address xxx Has Generated an Interrupt").*/
printf ("\n\n SRQ event occurred!\n");
printf ("\n ... Original Device Session = %t\n",viESA);
/*Get the GPIB address of the insrument, which has interrupted*/
viQueryf(viESA,"SYST:COMM:GPIB:SELF:ADDR?\n","%t", cBuf);
printf ("\n Instrument at GPIB address %s has generated an interrupt!\n",cBuf);
/*Get the status byte*/
/* If the ESA generated the interrupt, determine the nature of the interrupt;
did the measurement complete or an error message occur?*/
viQueryf(viESA, "*ESR?\n", "%d", &iStatusByte);
if ( (0x01 & iStatusByte))
printf("\n SRQ message:\t Measurement complete\n");
else if ( (0x02 | 0x10 | 0x20 & iStatusByte ))
printf ("\n SRQ message:\t Error Message Occurred\n");
/*Return successfully*/
iSrqOccurred =1;
viReadSTB(viESA,&iStatusByte);
return VI_SUCCESS;
}
/* Main Program*/
void main()
{
/*Program Variables*/
ViStatus viStatus = 0;
long lOpc=0;
/* Open a GPIB session at address 18*/
viStatus=viOpenDefaultRM(&defaultRM);
int address =18;
viStatus=viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viESA);
if(viStatus)
{

Table of Contents

Other manuals for Agilent Technologies E7401A

Questions and Answers:

Question and Answer IconNeed help?

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

Agilent Technologies E7401A Specifications

General IconGeneral
BrandAgilent Technologies
ModelE7401A
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals