How does SCPI
Work in the
Instrument?
The functions inside an instrument that
control the operation provide SCPI com
-
patibility. Figure 3-3 shows a simplified
logical model of the message flow inside
a SCPI instrument.
When the controller sends a message to a
SCPI instrument, roughly the following
happens:
–
The GPIB controller addresses the instru
-
ment as listener.
–
The GPIB interface function places the
message in the Input Buffer.
–
The Parser fetches the message from the
Input Buffer, parses (decodes) the message,
and checks for the correct syntax. The in-
strument reports incorrect syntax by send-
ing command errors via the status system
to the controller. Moreover, the parser will
detect if the controller requires a response.
This is the case when the input message is
a query (command with a “?” appended).
The Parser will transfer the executable
messages to the Execution Control block
in token form (internal codes). The Exe
-
cution Control block will gather the infor
-
mation required for a device action and
will initiate the requested task at the ap
-
propriate time. The instrument reports ex
-
ecution errors via the status system over
the GPIB and places them in the Error
Queue.
–
When the controller addresses the instru
-
ment as talker, the instrument takes data
from the Output Queue and sends it over
the GPIB to the controller.
Message Exchange Control
protocol
Another important function is the Mes
-
sage Exchange Control, defined by
IEEE 488.2. The Message Exchange
Control protocol specifies the interactions
between the several functional elements
that exist between the GPIB functions
and the device-specific functions, see
Figure 3-3 .
The Message Exchange Control protocol
specifies how the instrument and control
-
ler should exchange messages. For exam
-
ple, it specifies exactly how an
instrument shall handle program and re
-
sponse messages that it receives from and
returns to a controller.
This protocol introduces the idea of com-
mands and queries; queries are program
messages that require the device to send a
response. When the controller does not
read this response, the device will gener-
ate a Query Error. On the other hand,
commands will not cause the device to
generate a response. When the controller
tries to read a response anyway, the de-
vice then generates a Query Error.
The Message Exchange Control protocol
also deals with the order of execution of
program messages. It defines how to re
-
spond if Command Errors, Query Errors,
Execution Errors, and Device-Specific er
-
rors occur. The protocol demands that the
instrument report any violation of the
IEEE-488.2 rules to the controller, even
when it is the controller that violates
these rules.
The IEEE 488.2 standard defines a set of
operational states and actions to imple
-
ment the message exchange protocol.
These are shown in the following table:
3-4 How does SCPI Work in the Instrument?
Introduction to SCPI