Using the Matrix Modules 45Chapter 3
Detecting Error Conditions
SYSTem:ERRor? requests a value from instrument's error register. This
register contains an integer in the range [-32768 to 32767]. The response
takes the form <err_number>,<err_message>, where <err_number> is the
value of the instrument's error and <err_message> is a short description of
the error.
If no error occurs, the switchbox responds with 0,"No error". If there has
been more than one error, the instrument will respond with the first error in
its error queue. Subsequent queries continue to read the error queue until it
is empty. The maximum <err_message> string length is 255 characters.
Example: Detecting
Error Conditions
(BASIC)
This BASIC example program attempts an illegal channel closure for the
E1466A 4x64 matrix module and polls for the error message.
10 DIM Err_num$[256]
! Dimensions Err_num$ for 256
characters
20 OUTPUT 70915; "CLOS (@10500)"
! Try to close an illegal channel
30 OUTPUT 70915; "SYST:ERR?"
! Check for a system error
40 ENTER 70915; Err_num$
! Enter the errors into Err_num$
50 PRINT Err_num$
! Prints error +2001, "Invalid
channel number"
60 END
Example: Detecting
Error Conditions
(TURBO C)
This Turbo C example program attempts an illegal channel closure for the
E1466A 4x64 matrix module and polls for the error message.
#include <stdio.h>
#include <chpib.h> /*
Include file for GPIB
*/
#define ISC 7L
#define MATRIX 70915L /*
Matrix module default address
*/
#define TASK1 "CLOSE (@10500)" /*
Command for illegal switch closure
*/
#define TASK2 "SYST:ERR?" /*
Command for system error
*/
main()
{
char into[257];
int length = 256;
/*
Output commands to matrix module
*/
error_handler (IOTIMEOUT (7L,5.0), "TIMEOUT");
error_handler (IOOUTPUTS (MATRIX, TASK1, 15), "OUTPUT
command");
error_handler (IOOUTPUTS (MATRIX, TASK2, 9), "OUTPUT command");