# Queries

SCPI Basics

- Program Message Terminator
- Short or Long Forms
- White Space
- Combining Commands
- Adding Parameters to a Command
- String Arguments
- Numbers
- Infinity Representation
- Queries
- Endianness of Returned Binary Block Data
- NaN (Not A Number)
- Sequential and Overlapped Commands
- SCPI Tree

Command headers immediately followed by a question mark (?) are queries. After receiving a query, the instrument interrogates the requested subsystem and places the answer in its output queue. The answer remains in the output queue until it is read or until another command is issued. When read, the answer is transmitted across the bus to the designated listener (typically a computer). For example, the query:

    :TIMebase:SCALe?

places the horizontal timebase scale setting in the output queue. Use your programming environment's input statement to pass the value across the bus to the computer and place it in a variable. Queries can be used to discover how the instrument is currently configured as well as to return measurement results. For example, the command:

    :MEASure:EYE:RTIMe?

says to measure the rise time of your eye diagram and place the result in the output queue. The output queue must be read before the next program message is sent. For example, when you send the query `:MEASure:EYE:RTIMe?` you must follow it with an input statement. If you send another command or query before reading the result of a query, the output buffer is cleared and the current response is lost. This also generates a query-interrupted error in the error queue. If you execute an input statement before you send a query, it will cause the computer to wait indefinitely.

If a measurement cannot be made because of the lack of data, because the source signal is not displayed, the requested measurement is not possible (for example, a period measurement on an FFT waveform), or for some other reason, 9.99999E+37 is returned as the measurement result. You can send multiple queries within a single program message, but you must also read them back within a single program 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. For example, the response of the query:

    :MEASure:EYE:RTIMe?;FTIMe?

would be:

    <range_value>;<delay_value>