Options—2230 Service
“ Instrument Interfacing Guide” . Before a program can be
used for controlling the oscilloscope, the RS-232-C param
eters (baud rate, line terminator, and parity) must be set.
These parameters are selected and set at the oscilloscope
using the RS-232-C PARAMETERS switch.
Programs are usually composed of two main parts (or
routines), which can be generally categorized as a com
mand handler and a service-request handler.
Command Handler
Basically, a command handler should establish com
munication between the controller and oscilloscope, send
commands and queries to the oscilloscope, receive
responses from the oscilloscope, and display responses as
required. The following outline indicates the general
sequence of functions that the command-handling routine
should perform to accommodate communications between
the controller and oscilloscope.
1. Initialize the controller.
2. Check for a service request from the oscilloscope
(by sending an EVEnt query); if not zero, service the
request.
3. Get the command to send to the oscilloscope.
4. Send the command to the oscilloscope.
5. Check for a response from the oscilloscope.
6. If there is a response, perform the desired function.
If there is also an error response, perform step 2.
7. You are ready for a new command. Repeat the
functions in statements 2 through 7 as many time as
desired.
Service-Requqst Handler
The typical service-request handler routine contains the
necessary instructions to permit proper processing of ser
vice requests. For example, whenever power-on occurs,
the oscilloscope sends an SRQ. If a GPIB program is
operating on the controller when a power-on SRQ is gen
erated, the program should be able to determine that the
oscilloscope’s power was interrupted at some time during
program operation. This event could cause improper pro
gram execution, unless the program was written to ade
quately handle the possibility of a power-on SRQ occur
ring. Other events for which the oscilloscope generates
SRQ are identified in Table 7-32.
The following general steps are required to handle ser
vice requests from the oscilloscope:
1. Send an EVENT? query to the oscilloscope request
ing service.
2. If the EVENT? query response is not zero, then per
form the desired response to the event.
3. Return to the main program.
RESET UNDER COMMUNICATION
OPTIONS CONTROL
The oscilloscope may be set to its power-up state by
sending the INIt command via the communication option.
This command always initiates the power-up self tests. On
completion of power-up tests, SRQ code 65 (operation
complete) is generated, and the oscilloscope enters the
normal operating state. If there is a self-test error, the
option also generates SRQ code 65 and does not shift the
instrument to the normal operating state. Invoking the INIt
command can simplify a program. When using INIt, fewer
commands will usually be needed to set the instrument
state, since all front-panel settings may not need to be
individually specified.
STATUS AND ERROR REPORTING
The status and error reporting system used by the
Communication Options interrupts the bus controller. On
the GPIB Option, the bus controller is interrupted by
asserting the Service Request (SRQ) line on the bus. This
SRQ provides the means of indicating that an event (either
a change in status or an error) has occurred. To service a
request, the GPIB controller performs a Serial Poll; in
response, the instrument returns a Status Byte (STB),
which indicates the type of event that occurred. On the
RS-232-C Option, as soon as a change of status or an
error occurs, the instrument returns a Status Byte (STB),
which indicates the type of event that occurred. Bit 4 of
the Status Byte is used to indicate that the command pro
cessor is active. This bit is set when the command proces
sor is executing a command, and reset when it is not. The
Status Byte, therefore, provides a limited amount of infor
mation about the specific cause of the SRQ. The various
status events and errors that can occur are divided into
several categories as defined in Table 7-31.
Each time the GPIB controller performs a serial poll, it
can cause a second SRQ if more than one error exists.
The most serious error at the time of the serial poll is the
error reported. An EVEnt? query returns a number indicat
ing the specific type of error that occurred. Table 7-32 lists
the EVEnt? codes generated by the communication
options.
7-34