The purpose of the status reporting system is to monitor the status of one or several devices in a measuring system. To do this and react appropriately, the controller must receive and evaluate the information of all devices. The following standard methods are used:
Service request (SRQ) initiated by the measuring device
Serial poll of all devices in the bus system, initiated by the controller in order to find out who sent a SRQ and why
Parallel poll of all devices
Query of a specific instrument status by means of commands
Query of the error queue
The measuring device can send a service request (SRQ) to the controller. Usually this service request causes an interrupt, to which the control program can react appropriately.
As shown in the graphical overview, an SRQ is initiated if one or several of bits 2, 3, 4, 5 or 7 of the status byte are set and enabled in the SRE. Each of these bits summarizes the information of a further register, the error queue or the output buffer.
The ENABle parts of the status registers can be set such that arbitrary bits in an arbitrary status register initiate an SRQ. To use the possibilities of the service request effectively, all bits in the enable registers SRE and ESE should be set to "1".
Examples:
Set bit 0 in the ESE (Operation Complete).
Set bit 5 in the SRE (ESB).
Insert *OPC in the command sequence (e.g. at the end of a sweep).
As soon as all commands preceding *OPC have been completed, the instrument generates an SRQ.
Generate an SRQ when a limit is exceeded
Set bit 3 in the SRE (summary bit of the STATus:QUEStionable register, set after STATus:PRESet)
Set bit 10 in the STATus:QUEStionable:ENABle register (summary bit of the STATus:QUEStionable:LIMit1 register)
Set bit 1 in the STATus:QUEStionable:LIMit1:ENABle register
The analyzer generates an SRQ when the event associated with bit 1 of the STATus:QUEStionable:LIMit1:ENABle register occurs, i.e. when any point on the first trace fails the limit check.
Find out which event caused an SRQ
The procedure to find out which event caused an SRQ is analogous to the procedure to generate an SRQ:
STB? (query the contents of the status byte in decimal form)
If bit 3 (QUEStionable summary bit) is set, then:
STAT:QUES:EVENT? (query STATus:QUEStionable register)
If bit 10 (QUEStionable:LIMit1 summary bit) is set, then:
Query STAT:QUES:LIMit1:EVENT? (query STATus:QUEStionable:LIMit1 register)
If bit 1 is set, then the first trace failed the limit check.
The SRQ is the only possibility for the instrument to become active on its own. Each controller program should set the instrument such that a service request is initiated in the case of malfunction. The program should react appropriately to the service request.
In a serial poll, the controller queries the STatus Bytes of the devices in the bus system one after another. The query is made via interface messages, so it is faster than a poll by means of *STB?.
The serial poll method is defined in IEEE 488.1 and used to be the only standard possibility for different instruments to poll the status byte. The method also works for instruments which do not adhere to SCPI or IEEE 488.2.
The Visual BASIC command for executing a serial poll is "IBRSP()".
The serial poll is mainly used to obtain a fast overview of the state of several instruments connected to the controller.
In a parallel poll, up to eight instruments are simultaneously requested by the controller by means of a single command to transmit 1 bit of information each on the data lines, i.e., to set the data line allocated to each instrument to a logical "0" or "1".
In addition to the SRE register, which determines the conditions under which an SRQ is generated, there is a Parallel Poll Enable register (PPE). This register is ANDed with the STB bit by bit, considering bit 6 as well. The results are ORed, the result is possibly inverted and then sent as a response to the parallel poll of the controller. The result can also be queried without parallel poll by means of the command "*IST?".
The instrument first has to be set for the parallel poll using the Visual BASIC command "IBPPC()". This command allocates a data line to the instrument and determines whether the response is to be inverted. The parallel poll itself is executed using "IBRPP()".
The parallel poll method is mainly used to find out quickly which one of the instruments connected to the controller has sent a service request. To this effect, SRE and PPE must be set to the same value.
Each part of any status register can be read by means of queries. There are two types of commands:
The common commands *ESR?, *IDN?, *IST?, *STB? query the higher-level registers.
The commands of the STATus system query the SCPI registers (STATus:QUEStionable...)
All queries return a decimal number which represents the bit pattern of the status register. This number is evaluated by the controller program.
Decimal representation of a bit pattern
The STB and ESR registers contain 8 bits, the SCPI registers 16 bits. The contents of a status register is keyed and transferred as a single decimal number. To make this possible, each bit is assigned a weighted value. The decimal number is calculated as the sum of the weighted values of all bits in the register that are set to 1.
|
|
Example: The decimal value 40 = 32 + 8 indicates that bits no. 3 and 5 in the status register (e.g. the QUEStionable status summary bit and the ESB bit in the STatus Byte) are set.
Queries are usually used after an SRQ in order to obtain more detailed information on its cause.
Each error state in the instrument leads to an entry in the error queue. The entries of the error queue are detailed plain text error messages that can be looked up in the Error Log or queried via remote control using SYSTem:ERRor[:NEXT]? or SYSTem:ERRor:ALL?. Each call of SYSTem:ERRor[:NEXT]? provides one entry from the error queue. If no error messages are stored there any more, the instrument responds with 0, "No error".
The error queue should be queried after every SRQ in the controller program as the entries describe the cause of an error more precisely than the status registers. Especially in the test phase of a controller program the error queue should be queried regularly since faulty commands from the controller to the instrument are recorded there as well.