Power Supply · SCPI command comparison

Keysight N5767A vs Sorensen XG40-21: SCPI commands and remote control compared

In TestFlow's instrument library, the Keysight N5767A takes 75 SCPI commands, 39 of them queries, and the Sorensen XG40-21 takes 26 SCPI commands, 10 of them queries. That is 49 more on the N5767A. Counting distinct command headers (the command path without its arguments), 14 are accepted by both, 51 exist only on the N5767A, and 8 only on the XG40-21. 22% of the N5767A's command headers also exist on the XG40-21.

Both libraries have commands under OUTPut, SYSTem, and MEASure. Only the N5767A has VOLTage, STATus, CURRent, INITiate, TRIGger, and ABORt. Only the XG40-21 has SOURce.

Both libraries synchronise with *OPC?. Both libraries read errors with SYSTem:ERRor?.

TestFlow's library gives the XG600-1.4, XG8-100, XG80-10.5, XTR100-17, XTR100-8.5, XTR12-70, XTR150-11.2, XTR150-5.6, XTR20-42, XTR20-84, XTR300-2.8, XTR300-5.6, XTR33-25, XTR33-50, XTR40-21, XTR40-42, XTR6-110, XTR60-14, XTR60-28, XTR600-1.4, XTR600-2.8, XTR7.5-140, XTR8-100, XTR80-10.5, and XTR80-21 the same command set as the XG40-21, so the XG40-21 column applies to them too.

N5767A commands
75
XG40-21 commands
26
Shared headers
14
Unique headers
59

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keysight N5767A or Sorensen XG40-21 and writes the report from the measured results.

Get started

N5767A vs XG40-21 at a glance

Counts come from TestFlow's instrument library, the command sets its AI agent uses to drive each instrument. A distinct command header is the command path without its arguments, so :OUTPut ON and :OUTPut OFF count once.

Keysight N5767ASorensen XG40-21
Commands in TestFlow's library7526
Queries (read a value or state)3910
Settings and actions3616
Subsystems108
Distinct command headers6522
Headers the other lacks518
Command languageSCPISCPI
Operation complete*OPC?*OPC?
Error queueSYSTem:ERRor?SYSTem:ERRor?
Models on this command setN5767AXG40-21, XG600-1.4, XG8-100, XG80-10.5, XTR100-17, XTR100-8.5, XTR12-70, XTR150-11.2, XTR150-5.6, XTR20-42, XTR20-84, XTR300-2.8, XTR300-5.6, XTR33-25, XTR33-50, XTR40-21, XTR40-42, XTR6-110, XTR60-14, XTR60-28, XTR600-1.4, XTR600-2.8, XTR7.5-140, XTR8-100, XTR80-10.5, XTR80-21

Commands both accept

14 command headers are in both libraries. Here are 12, taken across subsystems. Where the XG40-21 library writes the command differently, its form is shown under the N5767A's.

CommandWhat it does
OUTPut:STATe <state>XG40-21: :OUTPut:STATe ONSet Output Enable. Enables or disables the power supply output.
SYSTem:ERRor?Query Error. Returns the next error number and message from the error queue.
MEAS:VOLT?XG40-21: :MEASure:VOLTage?Measure Voltage. Returns the measured output voltage.
*IDN?Identify Instrument. Returns manufacturer, model, serial number and firmware revision.
OUTPut:STATe?Query Output Enable. Returns 1 if the output is on, 0 if off.
MEAS:CURR?XG40-21: :MEASure:CURRent?Measure Current. Returns the measured output current.
*RSTReset Instrument. Resets the power supply to its factory-defined state.
OUTPut:PROTection:CLEarClear Output Protection. Clears latched protection signals that disabled the output.
*TRGGenerate Trigger. Generates a bus trigger when the trigger source is BUS.
*CLSClear Status. Clears event registers, status byte and error queue.
*OPC?Operation Complete Query. Returns 1 when all pending operations are complete.
*WAIWait To Continue. Holds off further commands until all pending operations complete.

Only on the Keysight N5767A

51 command headers in the N5767A library have no match in the XG40-21 library. Below are 22 of them from the 6 largest subsystems; the full list is in the Keysight N5767A command reference.

STATus (11 only on the N5767A)

CommandWhat it does
STATus:OPERation:EVENt?Read Operation Event Register. Returns the operation event register, which clears on read (CC, CV, WTG bits).
STATus:OPERation:CONDition?Read Operation Condition Register. Returns the live operation condition register (CC, CV, WTG bits).
STATus:OPERation:ENABle <value>Set Operation Enable Mask. Sets the operation enable mask for the operation summary bit.
STATus:OPERation:ENABle?Query Operation Enable Mask. Returns the operation enable mask.

VOLTage (10 only on the N5767A)

CommandWhat it does
VOLTage:LEVel <value>Set Voltage. Sets the immediate output voltage level in volts.
VOLTage:LEVel?Query Voltage Setting. Returns the programmed output voltage level in volts.
VOLTage:LEVel:TRIGgered <value>Set Triggered Voltage. Sets the triggered output voltage level transferred on trigger.
VOLTage:LEVel:TRIGgered?Query Triggered Voltage. Returns the triggered output voltage level in volts.

CURRent (8 only on the N5767A)

CommandWhat it does
CURRent:LEVel <value>Set Current. Sets the immediate output current level in amperes.
CURRent:LEVel?Query Current Setting. Returns the programmed output current level in amperes.
CURRent:LEVel:TRIGgered <value>Set Triggered Current. Sets the triggered output current level transferred on trigger.
CURRent:LEVel:TRIGgered?Query Triggered Current. Returns the triggered output current level in amperes.

IEEE 488.2 common (*) (8 only on the N5767A)

CommandWhat it does
*ESR?Read Standard Event Register. Returns the standard event status register and clears it.
*ESE <value>Set Standard Event Enable. Sets the standard event status enable register mask.
*ESE?Query Standard Event Enable. Returns the standard event status enable register mask.
*SRE <value>Set Service Request Enable. Sets the service request enable register mask.

INITiate (3 only on the N5767A)

CommandWhat it does
INITiateInitiate Trigger System. Initiates the trigger system so the next trigger changes the output.
INITiate:CONTinuous <state>Set Continuous Trigger Initiation. Enables or disables continuous initiation of output triggers.
INITiate:CONTinuous?Query Continuous Trigger Initiation. Returns the continuous trigger initiation state.

SYSTem (3 only on the N5767A)

CommandWhat it does
SYSTem:VERSion?Query SCPI Version. Returns the SCPI version number the instrument complies with.
SYSTem:COMMunicate:RLSTate <mode>Set Remote Local State. Sets front panel control, remote control, or remote with front panel locked.
SYSTem:COMMunicate:RLSTate?Query Remote Local State. Returns the remote/local state of the instrument.

Only on the Sorensen XG40-21

8 command headers in the XG40-21 library have no match in the N5767A library. Below are 6 of them from the 3 largest subsystems; the full list is in the Sorensen XG40-21 command reference.

SOURce (6 only on the XG40-21)

CommandWhat it does
:SOURce:VOLTage <Volt>Set Voltage. Sets the output voltage in volts.
:SOURce:VOLTage?Read Voltage Setting. Reads the programmed output voltage.
:SOURce:CURRent <Amp>Set Current. Sets the output current limit in amps.
:SOURce:CURRent?Read Current Setting. Reads the programmed output current limit.

IEEE 488.2 common (*) (1 only on the XG40-21)

CommandWhat it does
*TST?Self Test. Runs the self-test and returns 0 for pass or 1 for failure.

OUTPut (1 only on the XG40-21)

CommandWhat it does
:OUTPut:PROTection:FOLDback <Mode>Set Foldback. Sets foldback mode: 0 off, 1 trip on CV, 2 trip on CC.

Control both from Python

With PyVISA and any VISA backend, this opens both instruments, identifies them, sends one setting, and reads one value from each. For the setting, both libraries hold OUTPut:PROTection:CLEar (clear output protection), and the same line runs on each. For the reading, both libraries hold MEAS:VOLT? (measure voltage); the XG40-21 library writes it as :MEASure:VOLTage?. For the basics, see the PyVISA tutorial.

import pyvisa

rm = pyvisa.ResourceManager()
print(rm.list_resources())  # find both VISA addresses

a = rm.open_resource("PASTE_N5767A_ADDRESS")  # Keysight N5767A
b = rm.open_resource("PASTE_XG40_21_ADDRESS")  # Sorensen XG40-21
for inst in (a, b):
    inst.timeout = 5000  # ms
    print(inst.query("*IDN?"))

# The same setting on both: Clear Output Protection
a.write("OUTPut:PROTection:CLEar")
b.write(":OUTPut:PROTection:CLEar")

# The same reading on both: Measure Voltage
print(a.query("MEAS:VOLT?"))
print(b.query(":MEASure:VOLTage?"))

a.close()
b.close()

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keysight N5767A or Sorensen XG40-21 and writes the report from the measured results.

Get started

Frequently asked questions

What is the difference between the Keysight N5767A and the Sorensen XG40-21 for remote control?

In TestFlow's library the N5767A has 75 SCPI commands and the XG40-21 has 26 SCPI commands. 14 command headers are common to both, 51 are only on the N5767A (mostly STATus and VOLTage), and 8 are only on the XG40-21 (mostly SOURce and IEEE 488.2 common (*)).

Can I use the same SCPI code for the Keysight N5767A and the Sorensen XG40-21?

Partly. 14 command headers are accepted by both, including OUTPut:STATe, SYSTem:ERRor?, and MEAS:VOLT?. 59 are not, for example STATus:OPERation:EVENt? on the N5767A and :SOURce:VOLTage on the XG40-21, so a script that uses those needs a separate branch for each instrument.

Which has more remote commands, the N5767A or the XG40-21?

The N5767A: 75 commands for the N5767A against 26 for the XG40-21 in TestFlow's library. Of those, 39 on the N5767A and 10 on the XG40-21 are queries that read a value or state, and the library splits them into 10 and 8 subsystems.

How do the N5767A and XG40-21 signal operation complete and report errors?

Both libraries synchronise with *OPC?. Both libraries read errors with SYSTem:ERRor?. Each command named here is listed in the tables on this page and on each instrument's command reference.

Your next test, automated today

Describe the test. TestFlow builds the workflow, runs it on your instruments, and writes the report. See it on a bench like yours.