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

 

转载于:https://www.cnblogs.com/longbaobao326/p/10842587.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值