3-27
Programming
Reviewing SCPI Syntax Rules
Program message terminator
The string of instructions sent to the instrument are executed after the
instruction terminator is received. The terminator may be either a
new-line (NL) character, the End-Or-Identify (EOI) line asserted, or a
combination of the two. All three ways are equivalent. Asserting the
EOI sets the EOI control line low on the last byte of the data message.
The NL character is an ASCII linefeed (decimal 10). The NL terminator
has the same function as an EOS (End Of String) and EOT (End Of
Text) terminator.
Querying data
Data is requested from the instrument using a query. Queries can be
used to find out how the instrument is currently configured. They are
also used to get results of measurements made by the instrument, with
the query actually activating the measurement. String responses are
returned as upper-case letters.
Queries usually take the form of a command followed by a question
mark (?). After receiving a query, the instrument places the answer in
its output queue. The answer remains in the output queue until it is
read or another command is issued. For example, the query
OUTPUT 720;”:CALCULATE2:POINTS?”
places the number of points in the data set in the output queue. In HP
BASIC, the controller input statement:
ENTER 720;Range
passes the value across the bus to the controller and places it in the
variable Range. A newline character is appended to the response.
Sending another command or query before reading the result of a
query causes the output queue to be cleared and the current response
to be lost. This also generates an error in the error queue.
The output of the instrument may be numeric or character data
depending on what is queried. Refer to the specific commands for the
formats and types of data returned from queries.
You can send multiple queries to the instrument within a single pro-
gram message, but you must also read them back within a single pro-
gram message. This can be accomplished by either reading them back
into a string variable or into multiple numeric variables. When you
read the result of multiple queries into string variables, each response
is separated by a semicolon.