基本信息
源码名称:Read an Digit-Multimeter in Python
源码大小:1.70KB
文件格式:.py
开发语言:Python
更新时间:2019-04-09
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
Read an Digit-Multimeter in Python

try:
    # Create a connection (session) to the serial instrument
    resourceManager = visa.ResourceManager()
    session = resourceManager.open_resource(VISA_ADDRESS)
    print(VISA_ADDRESS)

    # For Serial and TCP/IP socket connections enable the read Termination Character, or read's will timeout
    if session.resource_name.startswith('ASRL') or session.resource_name.endswith('SOCKET'):
        session.read_termination = '\n'

    # If you've setup the serial port settings in Connection Expert, you can remove this section.
    # Otherwise, set your connection parameters
    session.set_visa_attribute(visa.constants.VI_ATTR_ASRL_BAUD, 115200)
    session.set_visa_attribute(visa.constants.VI_ATTR_ASRL_DATA_BITS, 8)
    session.set_visa_attribute(visa.constants.VI_ATTR_ASRL_PARITY, visa.constants.VI_ASRL_PAR_NONE)
    session.set_visa_attribute(visa.constants.VI_ATTR_ASRL_FLOW_CNTRL, visa.constants.VI_ASRL_FLOW_DTR_DSR)

    # Send the *IDN? and read the response
    session.write('*IDN?')
    idn = session.read()

    print('*IDN? returned: %s' % idn.rstrip('\n'))