pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
288 stars 124 forks source link

Very slow read with instruments connected by GPIB #248

Closed predator41 closed 4 years ago

predator41 commented 4 years ago

I want to configure the Model 2400 for maximum rate with the following commands ,but it takes about 22 Seconds to get the data, I test the same commands with NI VISA Test Panel, it's much faster Any way to speed up?

import visa
import time

visa_address = 'GPIB0::16::INSTR'

rm = visa.ResourceManager()
smu = rm.open_resource(visa_address)
smu.timeout = 3000 # ms
smu.write_termination = '\n'
smu.read_termination = '\n'
smu.send_end = True

print(smu.query("*IDN?"))

cmds = [
        "*RST",
        ":SOUR:FUNC VOLT",
        ":SOUR:VOLT:RANG 20",
        ":SENSE:FUNCTION:CONC OFF",
        ":SENS:FUNC \'CURR:DC\'",
        ":SOUR:VOLT 0",
        ":SOUR:DEL 0",
        ":DISP:DIG 4",
        "TRIG:DEL 0",
        "TRIG:COUNT 2100",
        ":SENSE:CURR:NPLC 0.01",
        ":SENS:CURR:PROT 10E-3",
        ":SENS:CURR:RANG 10E-3",
        ":SENSE:AVER:STAT OFF",
        "SYST:AZER:STAT OFF",
        "DISP:ENAB OFF",
        "*CLS",
        ":TRAC:POIN 2100",
        ":TRAC:CLE",
        ":TRAC:FEED:CONT NEXT",
        "STAT:MEAS:ENAB 512",
        "*SRE 1"
       ]

for cmd in cmds:
    smu.write(cmd)

smu.query("*OPC?")
smu.write(":OUTP ON")
smu.write("INIT")
smu.write("DISP:ENAB ON")
smu.write(":OUTP OFF")

start_time = time.time()
raw_data = smu.query("TRAC:DATA?")
#print(raw_data)
elapsed_time = time.time() - start_time
print("Elapsed Time:{}\r\n".format(elapsed_time))

smu.close()
rm.close()

Instrument details

Output of pyvisa-info

KEITHLEY INSTRUMENTS INC.,MODEL 2410,xxxx,C34 Sep 21 2016 15:30:00/A02 /J/K

Elapsed Time:22.975309371948242