NI VISA, pyVISA, python

在windows PC上安装:   1. 最新 NI-VISA程序包http://www.ni.com/visa/。RF设备使用VISA协议。 2. python 2x (3x以上不好用) 3. PyVisa package.  http://pyvisa.sourceforge.net/   测试。 例子, (和帖子TERA TERM中, 子script相同功能):  #!C:\Python27\python.exe import sys, os, visa, threading, time   PM = visa.instrument("TCPIP0::192.168.1.70::inst0::INSTR")   def check_read():     #currentdir = os.curdir     #fullname = os.path.join(currentdir, "read_pm.txt")     #fullname = os.path.join(".", "read_pm.txt")     if os.path.isfile("read_pm.txt"):         read_pm()         os.remove("read_pm.txt")        return   def read_pm():     PM.write("FETCh:CW:POWer?")     # Write file     fpm_read = open("pm_read_ok.txt","w")     fpm_read.write(PM.read())     fpm_read.close()     return   def main():     # Display ID     print PM.ask("*IDN?")     # Init PM     PM.write("*CLS")       # Main loop     while 1:         time.sleep(1)         check_read()   if __name__ == '__main__':     main()

 

上一篇:江卓尔:这个世界已多出货币*(比特币)和合同*(以太坊)


下一篇:《python数据分析基础》4.1.1:报错——sqlite3.OperationalError: table csv has 5 columns but 4 values were supplied