# -*- coding: utf-8 -*- """ this is a small demo program to control an HP/Agilent/Keysight DSO80000B that performs the following: * Identify Instrument * get Screenshot in binary mode and save to PNG * read Instrument Errors """ import pyvisa as visa rm = visa.ResourceManager() dso=rm.open_resource('USB0::1003::8293::Agilent_Technologies_DSO80204B_MY41234567_05.71.00::0::INSTR') print(dso.query('*IDN?')) i=dso.query_binary_values(':DISPLAY:DATA? PNG',datatype='B',is_big_endian=False,container=bytearray) w1=open('screenshot01.png', 'wb') w1.write(i) w1.close() inst_error='' while inst_error.strip() != '0': inst_error=dso.query('SYST:ERR?') print(inst_error) dso.close() rm.close()