1- 4 Keysight B2961A/B2962A SCPI Command Reference, Edition 6
Programming Basics
SCPI Commands
• Use a semicolon to separate commands within a message.
• There is an implied header path that affects how commands are interpreted by
the instrument.
The header path can be thought of as a string that is inserted before each command
within a message. For the first command in a message, the header path is a null
string. For each subsequent command, the header path is defined as the characters
that make up the headers of the previous command in the message up to and
including the last colon separator. An example of a message with two commands is:
OUTPut:STATe ON;PROTection ON
which shows the use of the semicolon separating the two commands, and also
illustrates the header path concept. Note that with the second command, the leading
header “OUTPut” was omitted because after the “OUTPut:STATe ON” command,
the header path became defined as “OUTPut” and thus the instrument interpreted
the second command as:
OUTPut:PROTection ON
In fact, it would have been syntactically incorrect to include the “OUTPut”
explicitly in the second command, since the result after combining it with the header
path would be:
OUTPut:OUTPut:PROTection ON
which is incorrect.
Moving Between Subsystems
In order to combine commands from different subsystems, you must reset the header
path to a null string within a message. This is done by beginning the command with
a colon (:), which discards any previous header path. For example, you could disable
the output relay protection function and check the status of the Operation Condition
register with a single message by using a root specifier as follows:
OUTPut:PROTection OFF;:STATus:OPERation:CONDition?
The following message shows how to combine commands from different
subsystems as well as within the same subsystem:
VOLTage:LEVel 7.5;RANGe 10;:CURRent:LEVel 0.1
Note the use of the optional header LEVel to maintain the correct path within the
subsystems, and the use of the root specifier to move between subsystems.