Changing Timeout Value in VISA Session in LabWindows CVI

Updated May 6, 2023



  • LabWindows/CVI

  • When I perform a VISA Read or VISA Write in LabWindows CVI, I receive an error stating:
        VISA: (HEX 0xBFFF0015) Timeout expired before operation completed.
  • Sometimes when my device takes longer than the default timeout value of my VISA session I receive a timeout error. How do I change the timeout value of my VISA session?

There are two ways to set the timeout value for your VISA session in LabWindows CVI:
  1.  Configure your VISA session using viOpen() :
                 When creating a VISA session using viOpen() one of the input parameters to this method is the timeout value:

                 viOpen(ViSession sesn, ViRsrc rsrc, ViAccessMode access, ViUInt32 Timeout, ViPSession vi)

       You set the timeout value with the fourth parameter in milliseconds.
  1. If you already have a VISA session open you can alter the timeout value using viSetAttribute():
               The function call will be:  viSetAttribute(VISA handle, Timeout timeout, int32 value)
The second parameter is the Timeout attribute of your VISA Session and the value is set in the third parameter.

Additional Information

You can set the timeout value to infinity by using the VI_TMO_INFINITE  constant attribute constant.