06-08-2011 11:23 AM
Greetings IVI Experts,
Most IVI class drivers seem to define an IVI class driver timeout error code. For instance IviScope defines (in iviscope.h):
#define IVISCOPE_ERROR_MAX_TIME_EXCEEDED (IVI_CLASS_ERROR_BASE+0x0003L)
That error code is BFFA2003. In the specific IVI driver code, if VISA returns the timeout code (BFFF0015), the returned error code is changed to BFFA2003. VISA defines the timeout code as such (in visa.h):
#define VI_ERROR_TMO (_VI_ERROR+0x3FFF0015L) /* BFFF0015, -1073807339 */
It turns out other IVI classes (IviDmm, IviPwrMeter, IviRfSigGen, IviSpecAn, IviSwtch) define their own maximum time exceeded code , but not IviFgen. That means no error conversion for class IviFgen. That seems rather odd. Anybody knows why? These files seem to be under IVI Foundation's control.
Solved! Go to Solution.
06-09-2011 10:08 PM
Hi Scipio,
Interesting point. I am seeing what you are talking about but there is no documentation on this. I will escalate this to try to figure out why that is. Please keep in mind, though, that the reasoning behind this may be proprietary information. I will update when I find out a little more about this. Have a great day!
Regards,
Jackie
06-10-2011 12:30 PM
Hi,
Fgen class does not have any read or fetch functions, only configuration functions. So there is no need for a time out.
A time out is useful when the driver is acquiring data from the instrument, such as in a DMM or Scope.
06-10-2011 01:24 PM
Hey Scipio,
JJP has it right. IVI Foundation is a driver standard that is not unique to National Instruments. More information can be found at the following website: http://www.ivifoundation.org/
Regards,
Jackie
06-13-2011 10:54 AM
Hi Jackie and JJP,
Thank you for your answers!
JJP has a good point, however, even if the IviFgen class doesn't fetch waveforms or measurements, it can still timeout. A good example would be Prefix_WaitForOPCCallback(). Let's say you are trying to load a setup, and possibly load a long waveform into memory. Or maybe there is a overlapped command that you need to know when it completes. You could get a timeout under these circumstances while waiting for the instrument to generate a service request.
Moreover, if the above logic was true, IviRfSigGen, IviSwtch, niFgen, niRFSG, niSwtch should not have ClassPrefix_ERROR_MAX_TIME_EXCEEDED defined. But one can find the following in the header files:
#define IVIRFSIGGEN_ERROR_MAX_TIME_EXCEEDED (IVI_CLASS_ERROR_BASE + 0x0003L)
#define IVISWTCH_ERROR_MAX_TIME_EXCEEDED (IVI_CLASS_ERROR_BASE + 22L)
#define NIFGEN_ERROR_MAX_TIME_EXCEEDED (IVI_SPECIFIC_ERROR_BASE + 19L)
#define NIRFSG_ERROR_MAX_TIME_EXCEEDED (IVI_SPECIFIC_ERROR_BASE + 0x3db)
#define NISWITCH_ERROR_MAX_TIME_EXCEEDED IVISWTCH_ERROR_MAX_TIME_EXCEEDED
I believe there is a need for a timeout error code in any type of instrument.
Best regards,
Scipio
06-14-2011 05:03 PM
Hi Scipio,
I went ahead and researched the differences between the NI and IVI drivers and found that the common denominator was the presence of a "Wait until..." function (see attached document for a screenshot of the Wait until functions for IviRfSigGen, IviSwtch, niFgen, niRFSG and niSwitch. The different between all these and the IVIFgen class is that it does not include any "Wait until" functions. This may be something for R&D to consider and I will speak to them regarding this. Thank you for this observation. Have a great day!
Regards,
Jackie
06-14-2011 05:23 PM
Thank you for your help, Jackie!
Most people don't worry about whether the timeout code is an IVI or VISA timeout. But I find it odd that the Fgen class didn't define it. Not a show stopper, just odd.
06-16-2011 10:23 AM
Scipio,
The IVI class drivers (and IVI drivers in general) are one level of abstraction higher than the I/O layer. They make no assumptions about what I/O library is used by the driver. It could be using NI-DAQ, GPIB, VISA or some proprietary library. Therefore, if the driver sends a command or query using VISA, for example, and that query results in a time-out, the driver simply return that error. It does not make sense to map these I/O errors at the IVI class level. (Why stop at time-out??)
The IVI_MAX_TIME_EXCEEDED errors are used for synchronous read/fetch data functions and some other functions where the time-out does not necessarily occur at the I/O layer but at the IVI driver layer.
I hope this clarifies the issue.
06-16-2011 12:38 PM
Thanks for your answer, z_haider.
There is no documentation on the IVI class timeout error codes that addresses this issue, so where did you get this info:
"The IVI_MAX_TIME_EXCEEDED errors are used for synchronous read/fetch data functions and some other functions where the time-out does not necessarily occur at the I/O layer but at the IVI driver layer."
Everyone writing IVI drivers understands that the IVI layer sits on top of the VISA layer. I've found the practice of changing the VISA timeout error code to the IVI class timeout error code in a well-written driver from NI. It's not my idea and it seemed odd at first (the VISA timeout error code is one of the most common error codes you get and I was already familiar with it), but I assumed it to be recommended practice since it came from NI.
If you are right then there should be no IVI Fgen class timeout error code defined, but the same should apply to IviRfSigGen, IviSwtch, niFgen, niRFSG, niSwtch. However, these classes do have the IVI timeout error code defined. Moreover, the error code translation in the IVI driver from NI doesn't only happen in fetch/read functions, but also in a global callback.
I might sound like a defense lawyer here, but I believe the comparison with the other classes that don't acquire any data is valid.
06-16-2011 02:51 PM - edited 06-16-2011 02:54 PM
Scipio,
If you look at sections 4.3.9 and 5.3.7 of the IviSwtch class specification, they define two functions (WaitforDebounce and WaitForScanComplete) that return the Max Time Exceeded error. (I said "read/fetch data functions and some other functions"). This is why the class driver defines this error code. There is no such function in the IviFgen class. You will find similar examples in the other class specifications you mentioned.
What the spec is saying is that if the driver implements the WaitForDebounce function, then it must return the IVISWTCH_MAX_TIME_EXCEEDED error code in the case of a time-out. To allow the user to write an interchangeable application for the IviSwtch API, the class driver defines this error code. Conversely, the IviFgen class API does NOT define this errror code because it will not be used by a class-compliant IviFgen application, since there is no function in the IviFgen spec that returns this error code.
Sure, a specific driver can choose to translate a VISA time-out error to an IVI time-out error code for any number of functions, in which case it will define the error code in its header.