9 Programming the Instrument
9.4 Status Register System & STATus Subsystem
*SRE
*SRE?
Service
Request
Enable
Sets and queries the value of the service request enable register
*STB?
Status Byte Queries the value of the status byte register without erasing its
contents
9.4.4 How to Use Status Registers
A program often needs to be able to detect and manage error conditions or changes
in instrument status.
There are two methods you can use to programmatically access the information in
status registers:
–
The "Polling Method" on page 2777
–
The "Service Request (SRQ) Method" on page 2778
The Polling Method works well if you do not need to know about changes the
moment they occur. To detect a change using this method, the program must
repeatedly read the registers.
The SRQ Method should be used if you must know immediately when a condition
changes.
Either method allows you to monitor one or more conditions.
9.4.4.1 Polling Method
In this method, the instrument has a passive role. It only tells the controller that
conditions have changed when the controller asks the right question.
Use this method when:
–
your programming language/development environment does not support SRQ
interrupts
–
you want to write a simple, single-purpose program and don’t want the added
complexity of setting up an SRQ handler
To monitor a condition:
–
Determine which register contains the bit that reports the condition
–
Send the unique SCPI query to read that register
–
Examine the bit to see if the condition has changed
2777 Spectrum Analyzer Mode User's &Programmer's Reference