嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在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'))