Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

How do I change the GPIB timeout using c#

$
0
0

Hello,

I'm trying to use C# to control my GPIB equipment.  As long as I use the default timeout, i can read/write/query with no problems.  Today I wanted to try to change the timeout so I tried the following command:



mbSession = (MessageBasedSession)ResourceManager.GetLocalManager().Open(visaAlias, AccessModes.NoLock, 10000);

 

int originalVisaTimeout = mbSession.Timeout;

int newVisaTimeout = 120000;

 

mbSession.Timeout = newVisaTimeout; // this does not work and changes to either 3000, 180000, or 300000 depending on the values i've tried for the timeout so far

mbSession.Timeout = originalVisaTimeout // this correctly sets the timeout back ot the origianl value.

 

Am I using the wrong Timeout property to set the GPIB Timeout? The documentation shows the following information.

//
// Summary:
// Gets or sets the minimum timeout value to use in milliseconds when accessing
// the device associated with the session.
//
// Exceptions:
// NationalInstruments.VisaNS.VisaException:
// The property is set to an invalid state.
//
// System.ObjectDisposedException:
// This member is called after the Dispose method is called directly from code
// or indirectly through a finalizer.
//
// System.DllNotFoundException:
// The NI-VISA driver library cannot be found.
//
// System.EntryPointNotFoundException:
// A required operation in the NI-VISA driver library cannot be found.
public int Timeout { get; set; }

 

Thanks,
Frank

 


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>