Hi everyone,
thanks in advance for your support.
I am communicating with a Keithley 2701 with a 7700 expansion module via Python code and RS232 interface.
The goal is to sample 8 channels of the board in polling, on which 8 thermocouples are installed.
I am attaching the code I arrived at, everything seems to work correctly, but the speed is very slow, especially considering the 8 channels to be switched.
How can I increase the sampling rate? I would like to optimize this script so as to maximize the number of points on each channel.
Would you know how to help me?
Thank you,
Matteo
Python Code:
import pyvisa
import time
import csv
rm = pyvisa.ResourceManager()
print(rm.list_resources())
instrument = rm.open_resource('ASRL39::INSTR', read_termination='\r\n', write_termination='\r\n')
instrument.timeout = 5000
instrument.baud_rate = 9600
instrument.data_bits = 8
instrument.parity = pyvisa.constants.Parity.none
instrument.stop_bits = pyvisa.constants.StopBits.one
instrument.flow_control = pyvisa.constants.VI_ASRL_FLOW_NONE
instrument.write('*IDN?')
instrument.write('TRAC:CLE')
instrument.write('*RST')
instrument.write('SYST:REM')
instrument.write("SENS:FUNC 'TEMP', (@110:117)")
instrument.write("SENS:TEMP:TC:TYPE K, (@110:117)")
instrument.write('SENS:CAV:DEL 0.5')
for channel in range(110, 117):
instrument.write(f'SENS:TEMP:DIG 5, (@{channel})')
instrument.write('ROUT:SCAN (@110:117)')
instrument.write('ROUT:SCAN:LSEL INT')
instrument.write('SAMP:COUN 1')
instrument.write('TRIG:COUN 1')
instrument.write('TRIG:DEL:AUTO OFF')
instrument.write('INIT:CONT ON')
try:
while True:
data = instrument.query('FETC?')
print(f'Dati acquisiti: {data}')
except KeyboardInterrupt:
instrument.write(':ABOR')
instrument.close()