HP VXI manual Srq

Page 17

void main(){ INST id; char addr[80]; char cmd[255]; int opc;

int idx;

printf("This program provides an interactive environment for SCPI \n"); printf("compatible instruments. \n\n");

printf("Enter the SICL address of the instrument to open.\n"); printf("for example: iscpi,24)\n");

gets(addr);

/* install error handler */ ionerror( I_ERROR_EXIT);

/* open the

instrument specified by the user */

id

= iopen(addr);

 

itimeout(

id,

20000);

/* 20 second timeout */

/*

set up

SRQ

handler */

 

ionsrq( id,

srq_hdlr);

 

/* enable MAV (bit 4) in status byte to cause an SRQ */ iprintf( id, "*SRE %d\n", MAV_MASK );

/* make sure *SRE finished */

 

ipromptf( id, "*OPC?\n", "%d", &opc);

/* opc value not used */

printf("\nEnter SCPI Commands/Queries to Instrument at %s\n", addr); printf(" (press return to exit)\n\n");

while(1)

 

{

 

while(0 == gets(cmd));

 

if( 0 == strlen(cmd))

 

break;

/* quit sending SCPI Commands */

/* send command */ iprintf(id, "%s\n", cmd);

/* check cmd for a ’?’, if found assume it is a query */ for(idx=0; idx<strlen(cmd); idx++)

if( ’?’ == cmd[idx])

{

/* wait up to 1 minute for srq handler */ if( 0 != iwaithdlr(60000))

{

printf("ERROR: Failed to process Query\n");

}

break;

}

}/* while - there are commands to send */ /* remove the handler */

ionsrq( id, 0);

/* close the session */

printf("\nClosing Instrument at %s\n", addr);

Chapter 2

Programming the Status System 17

Image 17
Contents Contents Comments Example QUEStionableEVENt? Printing History This Page Intentionally Left Blank Introduction Introduction Chapter General Status Register Model About this ChapterAn Example Sequence Condition Register Transition Filter Event RegisterPage Required Status Groups Status Byte Register Status Byte Bit Definitions Standard Event GroupStandard Operation Status Group Questionable Data Group Status System Programming Examples Handling SRQs Using MAV to Determine When Data is AvailableExample Program SRQ Icloseid Example Program Deverrmask Qryerrmask Chapter Programming the Status System Programming the Status System Chapter Command Reference OPERation CONDition? OPERationENABleSTATus PRESet OPERationENABle?OPERationEVENt? QUEStionable CONDition?QUEStionableEVENt? QUEStionableENABleQUEStionableENABle? STATQUESEVEN? CLS Common Command ReferenceESE mask EMC?ESE? ESR?LRN? IDN?LMC? OPC? OPCPMC RSTSRE? SRE maskSTB? TST?WAI Command Reference Chapter