Options—2230 Service
GPIB PROGRAMMING
Programming considerations are provided in this part to
assist in developing programs for interfacing to the oscillo
scope via the GPIB. For additional information see the
"Instrument Interfacing Guide” . Before a program can be
used for controlling the oscilloscope, the GPIB parameters
(primary address, message terminator, and talk/iisten
mode) must be set. These parameters are selected and
set at the oscilloscope using the GPIB 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 over the GPIB.
1. Initialize the controller.
2. Disable the service-request handler until the pro
gram is ready to handle them.
3. Get the GPIB address of the oscilloscope.
4. Enable the service-request handler.
5. Get the command to send to the oscilloscope.
6. Send the command to the oscilloscope.
7. Check for a response from the oscilloscope.
8. If there is a response, perform the desired function.
9. You are ready for a new command. Repeat the
functions in statements 5 through 9 as many time as
desired.
Service-Request Handler
The typical service-request handler routine contains the
necessary instructions to permit proper processing of
interrupts. For example, whenever power-on occurs, the
oscilloscope asserts an SRQ interrupt. If a GPIB program
is operating on the controller when a power-on SRQ is
received, 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
occurring.
Other interrupts (or events) for which the oscilloscope
asserts SRQ are identified in Table 7-32.
While some controllers have the capability of ignoring
service requests, others require that all SRQs be
managed. The programmer should understand the con
troller being used. If service requests are to be handled in
the program, the interrupts must first be enabled.
A service-request handler routine can be developed to
service interrupts when they occur during program opera
tion. It basically should consist of an interrupt-enabling
statement (ON SRQ) near the beginning of the program
and a serial-poll subroutine somewhere in the program.
The ON SRQ statement directs program control to the
serial-poll subroutine whenever an SRQ interrupt occurs.
For each interrupt received by the controller, the program
should perform a serial-poll subroutine.
The following general steps are required to handle ser
vice requests from the oscilloscope:
1. Perform a serial poll.
2. Send an EVENT? query to the oscilloscope request
ing service.
3. If the EVENT? query response is not zero, then per
form the desired response to the event.
4. Return to the main program.
RS-232-C PROGRAMMING
Programming considerations are provided in this part to
assist in developing programs for interfacing to the oscillo
scope via the RS-232-C. For additional information see the
7-33