User`s guide
2-9
Programming Getting Started
Receiving Information from the Instrument
Receiving Information from the Instrument
After receiving a query (command header followed by a question mark), the
instrument interrogates the requested function and places the answer in its
output queue. The answer remains in the output queue until it is read or another
command is issued. When read, the answer is transmitted across the interface
to the designated listener (typically a controller). The input statement for
receiving a response message from an instrument’s output queue typically has
two parameters; the device address, and a format specification for handling the
response message. For example, to read the result of the query command
:CHANNEL1:COUPLING? you would execute the HP BASIC statement:
ENTER <device address> ;Setting$
where <device address> represents the address of your device. This would
enter the current setting for the channel one coupling in the string variable
Setting$.
All results for queries sent in a program message must be read before another
program message is sent. For example, when you send the query
:MEASURE:RISETIME?, you must follow that query with an input statement.
In HP BASIC, this is usually done with an ENTER statement.
Sending another command before reading the result of the query clears the
output buffer and the current response. This also causes an error to be placed
in the error queue.
Executing an input statement before sending a query causes the controller to
wait indefinitely.
The format specification for handling response messages is dependent on both
the controller and the programming language.