
5790A
Operators Manual
5-24
5-50.
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 5790A 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 the Instrument Status" earlier in this section for more
information.
10 INIT PORT0
! IFC the bus
20 CLEAR PORT0
! DCL the bus
30 ! INITIALIZE THE 5790A 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 5790A SRQ
1130 ! TEST OTHER DEVICES RQS BITS IF DESIRED
1140 RESUME
1200 ! 5790A SRQ handler
1210 IF (SPL(6) AND 8) THEN GOSUB 1300 ! If (STB.EAV) call error handler
1220 ! Test other STB bits if desired here
1299 RETURN
1300 ! 5790A 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
5-51.
Taking a Measurement
The following program takes one measurement at a time.
10 REM Set Bus Timeout to 20 seconds, Init IEEE Bus
20 TIMEOUT 20 * 1000
30 INIT PORT 0
40 CLEAR @6
100 REM Reset 5790A, INPUT2, EXTERNAL Trigger
110 PRINT @6,"*RST; INPUT INPUT2; EXTRIG ON"
200 PRINT "Hit Carriage Return to take a Reading"
210 INPUTLINE A$
220 REM Trigger and wait for measurement, timeout after 15 seconds
230 PRINT @6, "MEAS? 15"
240 REM Read Magnitude,Frequency,Status
250 INPUT @6, V,F,S
260 IF S <> 0 THEN PRINT "Bad MEAS? Status"
270 PRINT V,F,S
280 GOTO 40
Summary of Contents for 5790A
Page 4: ......
Page 12: ...5790A Operators Manual vi...
Page 14: ...5790A Operators Manual viii...
Page 16: ...5790A Operators Manual 1 2...
Page 34: ...5790A Operators Manual 2 2...
Page 40: ...5790A Operators Manual 2 8...
Page 42: ...5790A Operators Manual 3 2...
Page 48: ...5790A Operators Manual 3 8...
Page 108: ...5790A Operators Manual 6 2...
Page 146: ...5790A Operators Manual 7 2...
Page 164: ...5790A Operators Manual 7 20...
Page 166: ...5790A Operators Manual 8 2...
Page 170: ...5790A Operators Manual 8 6...
Page 172: ...5790A Operators Manual 9 2...
Page 176: ...5790A Operators Manual...
Page 185: ...B 1 Appendix B ASCII and IEEE 488 Bus Codes...
Page 186: ...5790A Operators Manual B 2...
Page 187: ...Appendices ASCII and IEEE 488 Bus Codes B B 3...
Page 188: ...5790A Operators Manual B 4...
Page 204: ...5790A Operators Manual C 16...
Page 210: ...5790A Operators Manual D 6...