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 #158 background imageLoading...
Page #158 background image
158 Chapter 3
Programming Examples
Determine if an Error has Occurred
/* 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 SRQ Event Occurred!\n");
printf ("\n ... Original Device Session = %1d\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
either a measurement is uncalibrated or an error message has occurred?*/
viQueryf(viESA, "STAT:QUES:INT:EVEN?\n", "%d", &iStatusByte);
if ( (0x08 & iStatusByte))
printf("\n SRQ message:\t Measurement uncalibrated\n");
/* If the ESA generated the interrupt, determine the nature of the interrupt;
did is the measurement complete or an error message occur?*/
viQueryf(viESA, "*ESR?\n", "%d", &iStatusByte);
if ( (iStatusByte !=0) && (0x01 & iStatusByte))
printf("\n SRQ message:\t Measurement complete\n");
else if ( (iStatusByte !=0) && (0x02 | 0x10 | 0x20 & iStatusByte ))
printf ("\n SRQ message:\t Error Message Occurred\n");
/*Return successfully*/
iSrqOccurred =1;
viReadSTB(viESA, &iStatusByte);
return VI_SUCCESS;
}
void main()
{
/*Program Variables*/
ViStatus viStatus = 0;
long lOpc= 0L;
int iIntNum= 0;
long lCount= 0L;
/* Open a GPIB session at address 18*/
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viESA);
if(viStatus)
{
printf("Could not open a session to GPIB device at address 18!\n");
exit(0);

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