Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
108 ratings:
 3.57 out of 5   

Why Do I Receive Timeout Error -1073807339 on VISA Read or Write?



Primary Software: Driver Software>>NI-VISA
Primary Software Version: 4.7
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems, LabWindows/CVI Development Systems
Hardware: Instrument Connectivity Other, Serial, VXI/VME/MXI, GPIB

Problem:
When I perform a VISA Write or VISA Read operation, I receive  Error -1073807339. Timeout expired before operation completed, shown in the following dialog: 


Why do I receive this error and how do I resolve it?

Solution:
There are several reasons why you might receive this error message, the most common of which are detailed below:
  1. A timeout error is generally indicative of a different problem.  Check the command strings sent to the VISA Read and Write calls and ensure that they are written in the proper syntax for your instrument.

    Note: A new line or carriage return is often required at the end of a command. A good way to test this in LabVIEW is to right-click the command string control on the front panel and change the display to '\' Codes Display mode. In this mode, a carriage return is \r, a line feed is \n, and an end of line is \r\n. Verify that the command being sent to the serial device has the termination character that the device requires. 
  2. The port's communication settings may not be configured correctly. Verify that the Baud Rate, Data Bits, Parity, Stop Bits, and Flow Control are set correctly to correspond with your hardware requirements.

  3. This error may be induced by attempting to read more bits than are available at the serial port.

    • The VISA Property Node for Bytes At Port should be implemented to ensure that the data read by VISA is limited to exactly the amount of data available.

    • Additionally, you can verify that you are not trying to read too many bytes by reading only 1 byte at a time. If you do not get the error when doing so, increment the number of bytes you read until you get the timeout error again. This tells you how many bytes that command sends back.

      Note: If you still receive the error while reading only 1 byte, verify the command to make sure it has been written correctly and that you have also terminated the command string correctly (as brought up in solution 1).

  4. Older instrumentation may not respond rapidly to commands written to the port, causing a large delay between VISA Write and VISA Read. Applications designed to interface with this type of instrumentation should anticipate this delay, and implement a Wait function between VISA Write and Read to effectively avoid a potential timeout error.
  5. Timeouts can also occur when you read or write large amounts of data, since large data sets often take longer than the default timeout period of 2000 ms to transfer across the serial port. You can manually designate the VISA Session Timeout in different ways, depending on your development system. Please see below for instruction on setting the VISA Timeout:

    LabVIEW: You can use VISA Set Timeout located in the Functions palette under Instrument I/O » VISA » VISA Advanced


    LabWindows/CVI: You can use the viSetAttribute function with its Attribute_Name parameter is set to VI_ATTR_TMO_VALUE.

    Note: Changing the Timeout value for your VISA session will affect all VISA Writes and Reads in your session. However, you are able to set this property/attribute at any point during the session, allowing you to configure it as needed. 


Related Links:
KnowledgeBase 3F4AG87U : Timeout for VISA Read and Write VIs
LabVIEW 2012 Help: VISA Set Timeout
LabVIEW 2012 Help: VISA Bytes at Serial Port

Attachments:





Report Date: 03/25/2005
Last Updated: 03/16/2017
Document ID: 3JOF9K6K

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit