I'm working on an oscilloscope application (in C#), that uses the IviScope class driver to control any IviScope compliant instrument.
When setting the instrument's range to a value that is not supported (let's say 100Vpp), the driver function returns an error, and doesn't execute. I would however like the driver to set the range to the instrument's maximum.
Since the IVI specification doesn't allow the driver to limit this value, I need to limit it in my application. Therefore I want to know the instrument's capability with regard to the input range.
How can I get this information from the driver/instrument?
Sorry, but that doesn't help me... I already read it almost completely (I'm also developping an IviScope compliant driver for one of our digitizer modules), but I can't think of a way to solve my problem.
Only thing I can think of is successive approximation, but I don't think that's a very nice solution.
That is what you can do which I got it from our support in VS.
There are a couple days to approach this. First, I would advise against successive approximation. This could take a lot of time and might not converge in an expected manner for all cases. I would suggest querying the instrument for its maximum acceptable limits. If this is not possible I'd take a second look at what happens if you attempt to set the limits too high. In some cases, this will cause the instrument to set its limits to the highest extreme it can support and then throw an error. If this occurs, simply catch the error and warn the user that the device has been set to its highest possible limits. Then query the instrument for what the limits are currently set to, and have your program update to reflect those limits.
If both of the aforementioned methods fail, it will become necessary to either compile a database of limits based on the devices that are expected to be used with this program and then compare the device's identity to this table OR simply catch the error and inform the user that they'll need to choose a value that falls within the valid range.
Good luck en best regards,
In the "LabWindows/CVI Instrument Driver Developers Guide" I found the function Ivi_GetAttrMinMaxViReal64! This seems to do exactly what I need.
But I can't find this function in the Ivi specifications, nor in the IviScope spec. It is not exported in the IviScope header file. Is it of any use for me?
First, could you clarify what language the application is being written in? In your original post, you mentioned you are using C#. However, you are now referencing the LabWindows/CVI documentation, which is only used for ANSI C. If you are looking at this particular function in CVI, you can find it by going to Libraries»IVI Library»Attributes»Informationin the CVI Library Tree, as you can see below:
From here, you can open its Function Panel to take a look at the parameters for the function as well as see the function's help topic. Also, you can see more detailed help by going to Start»All Programs»National Instruments»IVI»IVI Driver Help and searching for GetAttrMinMaxViReal64 to get more information.
Is this what you are looking for? Please check the niScope IVI examples, as well, which can be found in the following directory:
I look forward to your response. I hope this helps!
* My instrument drivers are IVI-C (LabWindows/CVI)
* I have written a IviScope class driver wrapper in C# that wraps the native IviScope dll.
* My application is c#, and uses the IviScope class driver wrapper.
I have already found the documentation of the function Ivi_GetAttrMinMaxViReal64(), and it looks good for me. I am however in doubt if I can use it in my application. The Ivi spec doesn't mention this function, and it is not in the headerfile of the instrument driver, nor in IviScope.h.
In my application, for interchangeability, I only want to use driver functions that are available for all IviScope compliant drivers (through the IviScope class driver). And since the function Ivi_GetAttrMinMaxViReal64() is not in IviScope.h, I think I cannot access this function from outside the instrument driver.
Am I correct?
I did some more digging here, and there are Get and Set Attribute functions that are part of the IviScope class driver itself. If you are wanting the vertical range of a particular channel on the scope, for instance, perhaps they could use the IviScope_GetAttributeViReal64() function and pass the parameter for the vertical range, similar to the screenshot below:
This should return the vertical range of the channel specified using the handle to the particular instrument you want to check. In this manner, you would not have to use the more generic IVI functions that are available (such as the Ivi_GetAttrMinMaxViReal64() function), and if you created a wrapper around the entire IviScope driver for C#, you should already have this functionality built-in.
I hope this helps! Have a nice time,