LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I retrieve the MAX "Configurable Initial Settings" from within an IVI driver

Solved!
Go to solution

Hello Pblase,

        I think that the IVI Configuration Store function "Ivi_GetInfoFromResourceName" is what you are looking for.  Here is a description from the help:

 

This function returns the appropriate resource name and option string that Ivi_SpecificDriverNew function uses to create a new IVI session. The Resource Name can be an actual resource descriptor or a logical name or driver session name that the user configures with the IVI Configuration utility.

If the string that the user passes in the Resource Name parameter is an actual resource descriptor, this function returns the original resource descriptor and option string in the New Resource Name and New Option String parameters and returns VI_FALSE in the Is Logical Name parameter.

If the string that the user passes in the Resource Name parameter is a logical name or driver session name, this function returns strings in the New Resource Name and New Option String parameters based on the settings of the logical name or virtual instrument in the IVI Configuration Store. The function return VI_TRUE in the Is Logical Name parameter.

 

and help for the NewResourceName parameter:

 

If the string that the user passes for the Resource Name parameter is an actual resource descriptor, this function returns the original value of the Resource Name parameter in this parameter.

If the string that the user passes for the Resource Name parameter is a logical name or driver session name, then this parameter contains a resource descriptor that identifies the physical device based on the configuration of the logical name or virtual instrument in the IVI Configuration utility.

 

 

Another option is using "Ivi_IOSession" which is also available in the IVI Class Driver Wrapper VIs as a property under IVI Inherent Settings>>Advanced Setting Information>>IO Resource Descriptor

 

If your instruments return their serial numbers in the ID Query, you can also extract that data and identify the different instruments that way.

 

Let us know how it goes,

 

NathanT

0 Kudos
Message 11 of 24
(1,997 Views)
> But where do the MAX settings end up?
>IviConfigurationStore
I know that. But when the driver runs "Ivi_ApplyDefaultSetup(vi)" where does the configurable setting end up?
For instance:
* I write a stage driver with a class string attribute named STAGE_ATTR_DriverDescriptor, type ViSTring, default value "".
*In MAX, I set up a Driver Software Module for my stage driver and set the configurable setting tab with Name = "Stage_Description", Software Module Key = "STAGE_ATTR_DriverDescriptor", Type = "String", Default Value = "".
*In MAX, I then set up a Driver Session FRED of STAGE,  associate it with the proper Hardware Asset, and on the Configurable Settings tab set "Description" to a value of "that one over there".
Now If I interpret things right, when the driver runs "Ivi_ApplyDefaultSetup(vi)" in the _InitWithOptions()  function, it aught to set the attribute STAGE_ATTR_DriverDescriptor to the value "that one over there". It doesn't. What does it set to the value contained in the configuration store? It must do something with it. Nowhere do I see a way to look up the "Software Module Key" and find what it got set to for that particular driver session.
0 Kudos
Message 12 of 24
(1,975 Views)

Hello pblase,

       According to section 3.3.5 of the IVI Driver Architecture Spec: An IVI specific driver applies the configurable initial settings for the session when the user calls the Initialize
and Reset With Defaults functions.

 

Adding a Configurable Setting to the Software Module makes it possible to configure that setting in the Driver Session.  To actually have it applied to the instrument driver session, you must choose to use it in the Driver Session and configure it.

 

      Section 6.6.5.3 defines the Software Module Key as: A string that the IVI driver uses to identify the attribute and the repeated capability instance, if any. The IVI driver defines the contents of the string. Configuration utility programs should not display the string to the user.

 

There can be many Driver Sessions that use the same Software Module.  You would only want to programmatically read the Configurable Settings in the Software Module to see what could possibly be configured initially.  To find out what a specific Driver Session configures initially, you would want to programatically read the Driver Session settings in the Config Store.

 

Here is a Knowledgebase Article that explains it in more detail: KB 3GJATSBJ.

 

Cheers,

 

NathanT

0 Kudos
Message 13 of 24
(1,949 Views)
I've read these article, and I've figured out the points that you make. What they do not say is that after I call the "ResetWithDefaults" function, what attribute name I then give the "GetAttribute" function to actually retrieve the value that I entered in MAX. If I use the "Symbol Key" XXX to set an attribute in the INSTDVR driver, does it show up in the attribute named "XXX", or under "INSTDVR_ATTR_XXX", or where? I've preset the initialization values, but I can't figure out where they go to.
0 Kudos
Message 14 of 24
(1,945 Views)

Hello pblase,

         Here is an example call to GetAttribute:

checkErr( Ivi_GetAttributeViAddr( vi,  VI_NULL, AGN6700_ATTR_INSTR_INSTRUMENT_MODULES_RANGES, 0, (ViAddr*)&pinstrument_modules));

 

The attribute names are mostly defined in the header file, and the hidden attributes are defined in the c file.

 

An easier way to check and see is to run a NI-Spy capture and see if the correct instrument command was sent to the instrument (or just confirm that the instrument has the setting that you configured, not the instrument's default).

 

Cheers,

 

NathanT

0 Kudos
Message 15 of 24
(1,931 Views)
>         Here is an example call to GetAttribute:

checkErr( Ivi_GetAttributeViAddr( vi,  VI_NULL, AGN6700_ATTR_INSTR_INSTRUMENT_MODULES_RANGES, 0, (ViAddr*)&pinstrument_modules));

 

>The attribute names are mostly defined in the header file, and the hidden attributes are defined in the c file.

 

Except that MAX knows nothing about either one.

Please read this carefully, this is getting frustrating since it's obvious that you aren't understanding the original question:

 

Again, the problem is: if I set up a "Configurable Setting" in MAX for a Driver Session, with a Name of "StageDescriptor", a Software Module Key of "STAGE_ATTR_StageDescriptor", type = "String", and Value = "ABCDEFG", when I initialize the Stage driver and call "Ivi_ApplyDefaultSetup", the defined Stage driver Attribute "STAGE_ATTR_StageDescriptor" does not end up with the value "ABCDEFG". I have tried various combinations of Software Module Key values, and STAGE_ATTR_StageDescriptor never gets initialized. Nor can I find out what is being initialized with that string.

 

Of course, there is no table that I know of that allows MAX to associate the string in the Software Module Key with the .h file tag "STAGE_ATTR_StageDescriptor".

So: where is the initialized value ending up, and how do I get it where I want it to go? There are no examples of how to do this, and (unfortunately, as usual) inadequate documentation.

0 Kudos
Message 16 of 24
(1,928 Views)

Pblase,

         Please provide answers for each of these questions:

 

1.  What is the exact manufacturer and model of your instrument?

     1A.  Does it fall under one of the existing IVI Classes?

           If Yes: Are you using the appropriate IVI Class Driver?

           If No: Are you using a Custom Class Driver OR are you initializing the specific driver with the IVI Logical Name?

2.  Are you using an IVI-C Specific Driver?

     2A.  Is it NI-Certified and NI-Supported?

3.  Which Development Environment are you using (I know that you mentioned CVI)?

4.  Are you currently using a live instrument?

5.  Will your application use multiple Driver Sessions that use the same Software Module?

 

-NathanT

0 Kudos
Message 17 of 24
(1,908 Views)

I just tested the initial configurable settings of the agn6700 with the following settings and code:

 

 

I could change the value in the Driver Session, save the Config Store, and then run the example again and see the different value.  I am using the full attribute name of "AGN6700_ATTR_DIGITAL_PIN3_FUNCTION" for the Software Module Key and made sure to use the IVI Logical Name to initialize the Specific Driver.

 

-NathanT

Message Edited by NathanT on 03-18-2009 10:05 AM
0 Kudos
Message 18 of 24
(1,904 Views)

1.  What is the exact manufacturer and model of your instrument?

     1A.  Does it fall under one of the existing IVI Classes?

           If Yes: Are you using the appropriate IVI Class Driver?

           If No: Are you using a Custom Class Driver OR are you initializing the specific driver with the IVI Logical Name?

2.  Are you using an IVI-C Specific Driver?

     2A.  Is it NI-Certified and NI-Supported?

 

Newport NPESP300 Motion Controller and motion stages.

I'm writing my own drivers, using the LabWindows tools and the IVI standards.

There are actually 3 drivers: the NPESP300 instrument driver, a MotionController class driver, and a Stage driver that lets me control a stage regardless of which controller it's attached to. The system is configured using the Hardware Asset, Driver Session, and Logical Name capabilities of MAX.

 

3.  Which Development Environment are you using (I know that you mentioned CVI)?

 

LabWindows/CVI 8 under Windows XP

 

4.  Are you currently using a live instrument?

 

Yep

 

5.  Will your application use multiple Driver Sessions that use the same Software Module?

 

Yep

0 Kudos
Message 19 of 24
(1,889 Views)

I just tested the initial configurable settings of the agn6700 with the following settings and code

 

Thanks. Now I just have to figure out what I'm doing wrong.

Paul

0 Kudos
Message 20 of 24
(1,888 Views)