
2-12
Sample Programs
C Programming Examples
SRQ From GPIB Device Example
File: srq.c
/* file: srq.c */
/* This file contains the code to handle Service Requests from an GPIB device */
#include <stdio.h>
/* location of printf ( ), fopen ( ), and fclose ( ) */
#include "hpibdecl.h"
/*
* Function name: srq_handler
* Parameters: none
* Return value: none
* Description: This routine services the scope when an SRQ is generated.
* An error file is opened to receive error data from the scope.
*/
void srq_handler ( )
{
FILE *fp;
unsigned char statusbyte = 0;
int i =0;
int more_errors = 0;
char error_str[64] ={0};
int bytes_read;
int srq_asserted = TRUE;
srq_asserted = check_SRQ ( );
while (srq_asserted)
{
statusbyte = read_status ( );
if ( statusbyte & SRQ_BIT )
{
fp = fopen ( "error_list","wb" );
/* open error file */
if (fp == NULL)
printf ("Error file could not be opened.\n");
/* read error queue until no more errors */
more_errors = TRUE;
while ( more_errors )
{
write_IO (":SYSTEM:ERROR? STRING");
bytes_read = read_IO (error_str, 64L);
error_str[bytes_read] = '\0';
/* write error msg to std IO */
printf ("Error string:%s\n", error_str );
if (fp != NULL)
/* write error msg to file*/
Summary of Contents for 86100A
Page 18: ...1 14 Introduction Status Reporting Figure 1 4 Status Reporting Data Structures...
Page 19: ...1 15 Introduction Status Reporting Status Reporting Data Structures continued...
Page 94: ...2 40 Sample Programs BASIC Programming Examples...
Page 124: ...4 16 Root Level Commands VIEW...
Page 132: ...5 8 System Commands TIME...
Page 140: ...6 8 Acquire Commands SWAVeform RESet...
Page 152: ...7 12 Calibration Commands STATus...
Page 192: ...11 12 Display Commands SSAVer...
Page 202: ...12 10 Function Commands VERTical RANGe...
Page 203: ...13 AREA 13 2 DPRinter 13 2 FACTors 13 3 IMAGe 13 3 PRINters 13 4 Hardcopy Commands...
Page 316: ...21 12 TDR TDT Commands Rev A 05 00 and Below STIMulus...
Page 332: ......