VI_ERROR_TMO (-1073807339)

Question:

I’m using RS-232 port to communicate with KeithleyInstruments(SCPI Protocol) and have a problem.I can send the write command but when I send a query command it*s show the error below.

import visa
rm = visa.ResourceManager()
inst = rm.list_resources()
print inst
# print inst --> (u'USB0::0x05E6::0x2200::9060025::INSTR', u'ASRL1::INSTR', u'ASRL6::INSTR', u'ASRL7::INSTR', u'ASRL10::INSTR', u'GPIB0::16::INSTR')
keithleyInst= rm.open_resource('ASRL7::INSTR')
print keithleyInst.write("*rst")
print keithleyInst.write(":meas:temp?")
print keithleyInst.query(":meas:temp?")

Error:

pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Asked By: Mirza Grbic

||

Answers:

A query is a write and a read combined, so you only need the query, not the write.

If it still times out after removing the extra write, try setting a really long timeout like:

keithleyInst.timeout = 5000

To give it 5 seconds to respond. You can always shorten this once you’ve got it working.

If it still doesn’t respond, perhaps the instrument is not sending the termination character that VISA expects.

Try communicating with the instrument with a terminal program or National Instruments’ Measurement & Automation program to find out for sure what termination character it is sending (if it is sending anything).

You can change the termination character VISA expects by

keithleyInst.read_termination = 'r'

or something similar.

Answered By: Jeanne Pindar

As Jeanne Pindar answered, this can be due to a delay in answering or a bad read termination. It can also be linked to the baud rate of RS232 devices. You can set it with :

inst.baud_rate = 11520

Look at your constructor datasheet to specify the correct baudrate.

Answered By: Adrien Mau
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.