2-24
Sample Programs
Listings of the Sample Programs
*/
void setup_SRQ ( )
{
/* Enable Service Request Enable Register - Event Status Bit */
write_IO ("*SRE 32");
/* Enable Standard Event Status Enable Register enable Command Error - bit 4 - value 32 Query Error - bit 1 - value 4 */
write_IO ("*ESE 36");
} /* end setup_SRQ ( ) */
/*
* Function name: create_SRQ
* Parameters: none
* Return value: none
* Description: This routine sends two illegal commands to the scope which will generate an
* SRQ and will place two error strings in the error queue. The scope ID is requested to allow
* time for the SRQ to be generated. The ID string will contain a leading character which
* is the response placed in the output queue by the interrupted query.
*/
void create_SRQ ( )
{
char buf [256] = { 0 }; //read buffer for id string
int bytes_read = 0;
int srq_asserted;
/* Generate query error (interrupted query)*/
/* send legal query followed by another command other than a read query response */
write_IO (":CHANnel2:DISPlay?");
write_IO (":CHANnel2:DISPlay OFF");
/* Generate command error - send illegal header */
write_IO (":CHANnel:DISPlay OFF");
/* get instrument ID - allow time for SRQ to set */
write_IO ("*IDN?");
bytes_read = read_IO (buf,256L);
/* add NULL to end of string */
buf [bytes_read] = '\0';
printf ( "%s\n", buf);
srq_asserted = check_SRQ ( );
if ( srq_asserted )
srq_handler ( );
} /* end create_SRQ ( ) */