SCPI Command Execution

SCPI-99 describes two ways a command can execute, sequential or overlapped. The SCPI command reference indicates how the instrument executes each command, for both the command and the query forms. A sequential command does not allow any commands that follow it to execute until the sequential command has completed execution. An overlapped command allows other commands that follow it to execute at any time.


1378

You can think of sequential commands as serial commands, and overlapped commands as parallel, however, it's not that simple. A sequential command will start while a previous overlapped command is executing, which means that a sequential command can run in parallel with other overlapped commands.


1378

Overlapped commands execute more efficiently due to their parallel nature, so most of the commands implemented by the instrument are overlapped commands. In cases where it does not make sense to use overlapped commands, commands are implemented by the instrument as sequential commands. For example, in cases where overlapped commands can lead to misconfiguration or command parameter race conditions, sequential commands are used.

SCPI-99 includes synchronization methods to ensure that necessary commands have completed executing before the next set of commands begins. For example, if you want to change the frequency and initiate a measurement, you could use the following coupled command:
CONFigure:RFSA:GPRF:FREQuency <CenterFrequency>; :INITiate:RFSA:GPRF
Because both commands are overlapped, the execution would be similar to the following figure:

1378

Even though the configure command starts execution before the initiate command, initiation can start before configure finishes executing, causing the initiate to occur on the old frequency. SCPI-99 defines the *WAI (wait), *OPC, and *OPC? (operation complete) commands to use for synchronization. All three commands ensure that all prior execution has completed before any subsequent commands begin to execute. The difference among them is whether the client receives notification of the synchronization.

*WAI pauses execution until all running commands have finalized. For the following compound command:
CONFigure:RFSA:GPRF:FREQuency <CenterFrequency>; 
*WAI;:INITiate:RFSA:GPRF
*WAI causes the initiate command to execute only after the configure command has finished, as shown in the following figure.

1378

Note It is not necessary to precede *WAI or other commands that begin with an asterisk (*) with a colon (:) because the instrument knows those commands always start from the root.
The Operation Complete command and query (*OPC and *OPC?) execute in the same way, but each also produces an output to the client.

*OPC? places a 1 on the output queue when operation is complete. *OPC raises bit 0 in the event status register when operation is complete. Both outputs are used for client synchronization. For example, the client may wait until it receives 1 on the output queue from *OPC? before starting the DUT transmission, because Initiate has then completed executing and the instrument should be searching for a potential trigger.