# Sequential and Overlapped Commands

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

IEEE 488.2 makes a distinction between sequential and overlapped commands. Sequential commands finish their task before the execution of the next command starts. Overlapped commands run concurrently. Commands following an overlapped command may be started before the overlapped command is completed. The common commands `*WAI (Wait-to-Continue)` and `*OPC (Operation Complete)` may be used to ensure that commands are completely processed before subsequent commands are executed.

## The `*OPC` Command and `*OPC?` Query

The `*OPC` command sets bit 0 in the Standard Status Event Register when all pending device operations have finished. (Use `*ESR? (Event Status Register)` to query the register.) The `*OPC` command is useful for verifying the completion of commands that could take a variable amount of time or commands executed in parallel with other commands, such as `:SYSTem:AUToscale`. The `*OPC` command does not stop the execution of the remote script.

The `*OPC?` query allows synchronization between the computer and Infiniium 2026 by using the message available (MAV) bit (bit 4 in the Status Byte) or by reading the output queue. (Use `*STB? (Status Byte)` to query the Status Byte register.) Unlike the `*OPC` command, the `*OPC?` query does not affect the OPC event bit in the Standard Event Status Register. The execution of the remote script is halted and therefore the `*OPC?` query should be used judiciously. For example, running a acquisition limit test with the command string,

    :LTESt:ACQuire:STATe ON
    :ACQuire:RUN;*OPC?

locks the remote interface until specified number of acquisitions are completed, which could take some time. The *OPC topic provides a list of commands that require *OPC?.

## The `*WAI` Command

The `*WAI` command is similar to the `*OPC?` query as it also blocks the execution of the remote script until all pending operations are finished. `*WAI` is particularly useful if the host computer is connected to Infiniium 2026 and one or more instruments. This command will not block the SCPI command pipeline, allowing the computer to continue issuing commands to Infiniium 2026 or an instrument that is not executing the `*WAI` command.