cscpi_error()
NAME
cscpi_error /- Compiled SCPI Function
SYNOPSIS
cscpi_error (sicl_inst, error_number);
DESCRIPTION
This is a Compiled SCPI function. The C-SCPI error function provides error trapping for instrument run-time errors. Every time a run-time error is put into an instrument’s error queue, the cscpi_error function is called. However, you must write your own cscpi_error function. An example error routine that you can use is provided.
EXAMPLE
The example cscpi_error routine provided is called when a run-time error is put into an instrument’s error queue. This routine prints the instrument’s error number and message and exits the program. If you use this error routine, you must compile and link it into your main program:
cc -g -o example example.o cscpi_error.o -lcscpi -lsicl -lm
#include <cscpi.h>
void cscpi_error(INST sicl_inst, int error_number)
{
char string[20]="SYST:ERR?";
char result[255];
cscpi_exe(sicl_inst,string,strlen(string),result,sizeof(result));
printf ("ERROR: %s",result);
exit(1);
}
— December 08, 1992