I'm trying to write a program in C# that will query the VXI SMIP Switch Modules for their serial numbers. Right now I am able to view all the serial numbers through the soft front panel provided with the drivers but I need to automate this process and extract the serial numbers for further processing so I need to access the modules directly and read the data.
My current Setup:
[Computer with PCI-MXI-2 Board] ------> [ Racal Chassis with "SM1000E double wide Carrier" that can hold 6 VXI SMIP switch module plugin cards]
I'm able to see all resources in NI MAX.
The VXI resource is shown in NI MAX as : VXI0::26::INSTR
The VXI SM1000E Carrier that holds the 6 plugin module has logical address 26
and there are 6 modules in there carrier that is 0 based, module 1 is 0, module 2, is 1, module 3, is 2 and so on...
To my understanding, Visual Studio can automatically create wrapper code using the "Driver Wrapper Wizard" included with the T&M ToolKit. And by doing this I was able to access some of the functions of the drivers associated with this module.
I'm trying to use the vtvmSmip_QuerySmip function, which will return the NonVol data for up to six plug-in cards at once according to the documentation in the driver header file. The definition of the SMiP NonVol structure can be found in the vtvmSmip.h file. But I'm still unsure how to use it.
Using Visual Studio 2003, the function is available but it requires some arguments.
Below is the wrapper code generated.
[code]
private void button1_Click(object sender, System.EventArgs e)
{
// This code creates and initializes an instance of the VXIplug&play wrapper class
// TODO: Insert your appropriate values for address, idQuery etc.
Agilent.TMFramework.InstrumentDriverInterop.VxipnpWrappers.VtvmSmip myVtvmSmip;
myVtvmSmip = new Agilent.TMFramework.InstrumentDriverInterop.VxipnpWrappers.VtvmSmip("GPIB0::7::INSTR", true, true);
// TODO: Add your code here. For example:
// myVtvmSmip.Reset();
[code end]
I was wondering if, I want to use myvtvmSmip.QuerySmip(); What should I pass in as the arguments? This fuction suppose to return all 6 modules information. not sure how...
Its definition is as follows:
void VtvmSmip.QuerySmip(int smipStruct)
"smipStruct points to the locaton where the data is to be sotred. The Structure is of type vtvmSmip_SMIP_TYPE. Look in vtSmipDefs.h for the definition of vtvmSmip_SMIP_TYPE. Note: The Plug&Play spec prohibits exporting data structures, so the structure is not exported."
s
I get and exception when I use this as:
myVtvmSmip.QuerySmip(1);
didnt work gave me exception..
Another fuction I coulduse was this one.
myVtvmSmip.ReadNonvol();
I guess this returns 1 module at a time.
Definition:
voidVtvmSmip.ReadNonvol(short smodNmbr, System.Text.StringBuilder nvData)
I suppose smodnmbr responds to each module, 0, 1, 2, 3, 4, and 5.
I hope this isnt too much information.. I just want to be able to read the serial numbers of of these switch modules so I can process them. If anyone can help, that would be great. Thanks.
Chan