SCPI Command Execution
- Updated2023-04-26
- 3 minute(s) read
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.
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.
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.
CONFigure:RFSA:GPRF:FREQuency <CenterFrequency>; :INITiate:RFSA:GPRFBecause both commands are overlapped, the execution would be similar to the following figure:
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.
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.
*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.