FAQs from Rohde & Schwarz

NRX: How can I read out two channels via remote control

Question

NRX: How can I read out two channels via remote control?

Answer

Here a short Python example how you can read out the data of two channels:

# import VISA application
import pyvisa

# open the connection
rm=pyvisa.ResourceManager()
nrx = rm.open_resource('TCPIP::10.205.0.196::INSTR')

# set the timeout to 10s
nrx.timeout=10000
print(nrx.query("*IDN?"))

# reset the device
nrx.write("*RST;*CLS")
nrx.query("*OPC?")

# set to single measurement
nrx.write("INIT:ALL:CONT OFF")

# initiate a single measurement and wait for completion
nrx.write("INIT:ALL")
nrx.query("*OPC?")

# Get the data from channel 1
nrx.query("CALC1:DATA?")

# Get the data from channel 2
nrx.query("CALC2:DATA?")

# check for errors
print(nrx.query("SYSTEM:ERROR?"))

# close the connection
nrx.close()