
5820A
Operators Manual
5-46
You retrieve instrument parameters with a query (a programming command that ends
with a question mark):
200 PRINT @6, "FUNC?" ! RETRIEVE OUTPUT FUNCTION
210 INPUT LINE @6, A$
220 PRINT "Function is: "; A$
230 PRINT @6, "ONTIME?" ! RETRIEVE ON TIME
240 INPUT LINE @6, A$
250 PRINT "The instrument has been on for "; A$;" hours"
This program generates the following sample output:
Function is: DCV
The instrument has been on for 0 days, 02:23:58 hours
Check for programming errors as in the following sample programs. Check the Error
Available (EAV) bit in the serial poll register using a serial poll.
300 A = SPL(6) ! CHECK FOR ERRORS
310 IF (A AND 8) THEN PRINT "There was an error"
320 PRINT @6, "*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 @6, "ERR?" ! CHECK FOR ERRORS
410 INPUT @6, 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
5-60.
Writing an SRQ and Error Handler
It is good practice to include fault (error) handling routines in your applications. The
following sample program lines show a method for halting program execution on
occurrence of an SRQ (Service Request) on the bus, checking to see if the calibrator is
the source of the SRQ, retrieving its fault messages, and acting on the faults. You should
modify and extend this code as necessary for your application.
If you want to use SRQs, first use the
*SRE
,
*ESE
, and
ISCE
commands to enable the
desired event. Refer to "Checking 5820A Status" for more information.
10 INIT PORT0 ! IFC the bus
20 CLEAR PORT0 ! DCL the bus
30 ! INITIALIZE THE 5820A SRQ HANDLER
40 PRINT @6, "*SRE 8" ! Enable STB.EAV (error available)
50 ON SRQ GOTO 1100 ! Install SRQ handler
60 ! Body of the application goes here
1100 ! Bus SRQ handler
1110 CLEAR PORT0 ! Make sure devices are not confused
1120 IF (SPL(6) AND 64) THEN GOSUB 1200 ! If (STB.RQS) call SRQ
1130 ! TEST OTHER DEVICES RQS BITS IF DESIRED
1140 RESUME
1200 ! 5820A SRQ handler
1210 IF (SPL(6) AND 8) THEN GOSUB 1300 ! If (STB.EAV) call handler
1220 ! Test other STB bits if desired here
1299 RETURN
1300 ! 5820A STB.EAV (error) handler
1320 PRINT @6, "ERR?" ! Read and clear error
1330 INPUT @6, E%, E$ ! Read in error # and explanation
1340 PRINT "Error# :";E, E$ ! Print error # and explanation
1350 IF (E% <> 0) THEN GOTO 1320 ! Until no more errors
1360 STOP ! Other commands for your app
1370 END
Содержание 5820A
Страница 10: ...5820A Operators Manual vi ...
Страница 14: ...5820A Operators Manual x ...
Страница 16: ...5820A Operators Manual 1 2 ...
Страница 32: ...5820A Operators Manual 2 2 ...
Страница 40: ......
Страница 144: ...5820A Operators Manual 6 2 ...
Страница 190: ......
Страница 212: ...5820A Operators Manual 7 24 ...
Страница 214: ...5820A Operators Manual 8 2 ...
Страница 230: ...5820A Operators Manual 9 2 ...
Страница 234: ...5820A Operators Manual ...
Страница 244: ...5820A Operators Manual A 10 ...
Страница 245: ...B 1 Appendix B ASCII and IEEE 488 Bus Codes ...
Страница 246: ...5820A Operators Manual B 2 ...
Страница 248: ...5820A Operators Manual B 4 ...
Страница 250: ...5820A Operators Manual C 2 ...
Страница 258: ...5820A Operators Manual E 4 ...
Страница 264: ...5820A Operators Manual F 6 ...
Страница 272: ...5820A Operators Manual 8 ...