5560A/5550A/5540A
Remote Programmers Manual
38
To use SRQs, first use the *SRE, *ESE, and ISCE commands to enable the desired event, see Check
Product Status.
Retrieve instrument parameters with a query (a programming command that ends with a question
mark):
200 PRINT @4, “FUNC?” ! RETRIEVE OUTPUT FUNCTION
210 INPUT LINE @4, A$
220 PRINT “Function is: “; A$
230 PRINT @4, “ONTIME?” ! RETRIEVE ON TIME
240 INPUT LINE @4, A$
250 PRINT “The instrument has been on for “; A$;” minutes”
This program generates this sample output:
Function is: DCV
The instrument has been on for 134 minutes
Check for programming errors as in these sample programs. Check the Error Available (EAV) bit in the
serial poll register with a serial poll.
300 A = SPL(4) ! CHECK FOR ERRORS
310 IF (A AND 8) THEN PRINT “There was an error”
320 PRINT @4, “*CLS” ! CLEAR ERRORS
Retrieve errors and explanations as follows. Since errors are accumulated in a queue, you must read
the entire queue to retrieve and clear all the errors.
400 PRINT @4, “ERR?” ! CHECK FOR ERRORS
410 INPUT @4, A, A$ ! READ IN THE ERROR
420 IF (A = 0) THEN GOTO 500 ! NO MORE ERRORS
430 PRINT “Error# :”;A, A$ ! PRINT ERROR# AND EXPLANATION
440 GOTO 400
500 END
Writing an SRQ and Error Handler
It is good practice to include fault (error) handling routines in your applications. The sample program
lines below show a method to halt program execution on occurrence of an SRQ (Service Request) on
the bus, check to see if the Calibrator is the source of the SRQ, retrieve its fault messages, and act on
the faults. Modify and extend this code as necessary for your application.