FAQs from Rohde & Schwarz

NRX: 원격 제어로 두 채널을 읽는 방법

질문

NRX: 원격 제어로 두 채널을 읽으려면 어떻게 하나요?

답변

다음은 두 채널의 데이터를 읽는 방법을 보여주는 짧은 Python 예제입니다.

# 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()