GETTING STARTED WITH SCPI PROGRAMMING 2 - 5
2.3 Error Reporting
Instrument errors are usually caused by programming or setting errors. They are
reported by the instrument during the execution of each command. To make sure
that a program is running properly, you must query the instrument for possible er-
rors after every functional command. This is done by sending the
SYSTem:ERRor? query or the STATus:QUEue? query to the instrument, followed
by reading the response message. However, through this practice the same "error
reporting" statements must be repeated after sending each SCPI command. This
is not always practical. Therefore, one of the following approaches is advised:
1) Send the SYSTem:ERRor? or STATus:QUEue? query and read the instrument
response message after every group of commands that functionally belong to
each other.
2) Program an error-reporting routine and call this routine after each command
or group of commands. For an example of an error-reporting routine, refer to
section 3.14.4.1.
3) Program an error-reporting routine and use the "Service Request (SRQ)
Generation" mechanism to interrupt the execution of the program and to
execute the error-reporting routine. Therefore, refer to section 3.14.4.2.
PROGRAM EXAMPLE:
’
*****
’Read error message:
’
*****
er$ = SPACE$(60)
CALL Send(0, 8, "SYSTem:ERRor?", 1) ’
Requests for error
CALL Receive(0, 8, er$, 256) ’
Reads error message
PRINT "Response to error query = ";
PRINT LEFT$(er$, IBCNT%-1) ’
Displays error message