HP (Hewlett-Packard) HP VXI Water System User Manual


 
18 Programming the Status System Chapter 2
iclose(id);
}
Using a Service
Request to Detect
Errors
The following example program sets up an SRQ handler to be called when
SCPI errors are detected using the Standard Event Status Register. The
program then prompts for SCPI commands. If the SCPI command results in
data in the output queue (such an query command) or an error, then the SRQ
handler is called and the data is printed.
The following summarizes the procedure used:
Define a SRQ Handler which does the following:
-- Read the Status Byte using ireadstb
. ireadstb returns the RQS
(request for service) bit in bit 6 of the status byte. After issuing a
ireadstb, RQS is cleared indicating that the Service Request is being
acknowledged. A new SRQ will not be issued unless RQS is
cleared. Using *STB? will return the Master State Summary in bit 6
and does not affect RQS.
-- Check if the MAV bit (bit 4) is set to indicate that a message is
available. If the MAV bit is set, then a message is available and the
SRQ handler can process the message. In this example, the output
queue is read using iscanf
.
-- Check if the Standard Event Status summary bit (bit 5) is set. If the
bit is set then read the Standard Event Status Group’s Event Register
to determine which event(s) caused the SRQ. Check for Command
Error (bit 5), Execution Error (bit 4), Device Dependent Error (bit
3), or Query Error (bit 2). If found, read the error queue with
SYST:ERR? to print out error messages.
Enable SRQ Handler in SICL with ionsrq.
Enable MAV bit (Message Available Bit) and Standard Event Status
Register Summary Bit in the Status Byte Enable Register (e.g. *SRE
48). This will cause an SRQ to arrive when there is a message in the
output queue or when the summary bit is set in the standard event
status register.
Enable the Command Error, Execution Error, Device Dependent
Error, and Query Error enable bits in the Standard Event status enable
register (e.g. *ESE 60). This will cause the summary bit of the
standard event status register to be set when an error occurs.