CNLHC / NUEDC-Toolbox

全国大学生电子设计竞赛(National Undergraduate Electronics Design Contest)工具箱
24 stars 3 forks source link

使用VISA控制仪器进行自动化测试 #12

Closed CNLHC closed 5 years ago

CNLHC commented 5 years ago

通过虚拟仪器软件架构VISA (virtual instrument software architecture) 控制仪器进行自动化测试。

CNLHC commented 5 years ago

在 a0a4ec5eda4615dbf104eeea7922c4adcfc76ea9 中验证了通过python调用由Labview提供的Visa库,并控制鼎阳SDG6032信号源信号的输出。

CNLHC commented 5 years ago
import visa
import time
rm = visa.ResourceManager() 
DS= rm.open_resource('TCPIP::192.168.50.21::INSTR')
SDG= rm.open_resource('TCPIP::192.168.50.67::INSTR')
print(DS.query('*IDN?'))
print(SDG.query('*IDN?'))

print(DS.query(":MEASure:ADISplay?"))
for i in range(100,350,10):
    SDG.write("C1:BSWV FRQ,{0}".format(i*1e6))
    # print("{freq}Mhz,{vpp:%.2f}mV".format(freq=i,vpp=float(DS.query(":MEASure:VPP? CHAN1"))))
    time.sleep(0.1)
    print(i,',',float(DS.query(":MEASure:VPP? CHAN1"))*1000)
    time.sleep(0.2)

验证了通过TCP/IP协议访问仪器,以上Code Snippet用于测试 #13 HMC624A模块幅频性能。

CNLHC commented 5 years ago

@NPEIGHT 已经可以使用VISA进行自动化测试。