如何使用Python和GPIB接口访问安捷伦设备(借助NI GPIB转USB转换器)?
3 个回答
0
请尝试使用以下代码
import visa
rm=visa.ResourceMananger()
rm.list_resources()
#you can get a list of gpib address
test=rm.open_resource('your gpib address')
#try to open one of it
0
请尝试使用以下代码
import visa
import pylab
#Get instrument VISAname
visaInstrList = visa.get_instruments_list()
myScope = visaInstrList[0]+'::INSTR'
scope = visa.instrument(myScope)
1
另一个有用的工具是Agilent Connection Expert。这个工具可以告诉你是否有GPIB连接。如果你没有按照你指定的连接方式连接,那么你的代码就无法正常工作。这个软件会告诉你连接的地址,以及它是属于GPIB0、GPIB1等等。
import visa
from subprocess import Popen, PIPE
rm = visa.ResourceManager()
siggen = rm.get_instrument("GPIB1::19")
siggen.write("OUTP:STAT ON")
然后你可以写任何与你的设备兼容的SCPI命令。每个设备都有相应的手册。我不知道你的设备是什么,所以没有尝试过,但它在我的信号发生器上是有效的。希望这对你有帮助!