VXI and VME

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Query serial numbers on VXI smip modules.

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
 
 
 
 
 
 
 
 

 
0 Kudos
Message 1 of 8
(9,122 Views)
Hi Chan,

I had some questions for you.

1) Where did you get the driver for this device? Was this something you got from NI.com? or did you get it from the manufacturer of those modules? What mdules are you using? (Manufacturer, model number, etc).

2) Do you know what register holds that serial number? You should be able to do some low level VISA calls to just pull that number from the register it's on.

3) Are you getting any specific error messages with this?

We'll be able to help more with this information.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 2 of 8
(9,112 Views)
Hi Matt,
 
Thanks for your replay. Right now im trying to query the VXI Tech SMP1200 double slot carrier that holds 6 SMP5004 modules.  But I have other SMP switches as well after I figure this one out, I belive if I can do this one, they should be the same for the other switches.
 
I belive I have the drivers from the manufacturer.  When I try to implement the code below, I get an exception error.
The logical address of the SMP1200 Carrier is 26. And it has a resource name of "VXI0::26::INSTR" as should in NIMAX.
The SMP1200 holds 6 switch modules and I think its zero based ( Module 1 is 0, Module 2 is 1, Module 3 is 2 etc..up to 5)
reading through the vtSmipDefs.h file included with the drivers, It says QuerySmip() returns information about 6 modules at once.
ReadNonvol() reads one module at a time I belive.  Not sure how this works because using these functions, they dont return a value.  I don't know If I have to somehow read it back.
 
 
[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("VXI0::26::INSTR", true, true);
 // TODO:  Add your code here.  For example:
 // myVtvmSmip.Reset();
myVtvmSmip.QuerySmip(1);

[CODE}
 
The code above is automatically generated using the built in Agilent T&M Toolkit driver wrapper wizard in the menu in Visual Studio 2003.  using this code, the intellisense menu does appear to show all the class members functions from the driver.
When I run the program, I get an exception error.
 
Ill post the exact data as soon as im back at work.
 
I can also send you a link to the drivers and the help files that have some information about it. 
 
Im kinda a newbie here with programming in C# and also VXI/MXI.  This is just part of my whole application im writing.  So far I've been able to query all the instruments(meters, scopes, etc) through the GPIB using IDN query so far.  Just the VXI left and its killing me.  Appreciate you help.  Look forward to your reply.
 
Thanks Chan
 
 
 
0 Kudos
Message 3 of 8
(9,104 Views)
Hi Chan,

I'm not sure how much help I'll be able to be with this. It looks as though all of NI's software/hardware is working ok here. You're able to see your system through MAX. It looks like the rest of this is all 3rd party software that might be causing you headaches. You could move to using NI calls in your code to access those devices.

If you are able to see your devices in MAX, I'm assuming you have our NI-VXI driver installed. You also mention Agilent's driver toolkit. Which driver are you trying to use in the code? Verify that you have that driver installed for that device in Windows Device Manager.

Post more information on this if you can. Error messages, screenshots, etc might be helpful. Again, it sounds like NI's side of things is working ok.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 4 of 8
(9,090 Views)
I don't think there is anything wrong on the NI side.  Everything seems to work.  Just trying to obtain those serial numbers in code. 
 
 
The intellisense shows this QuerySmip function shows up fine after an instance of the object is create.
 
 
 
Image above shows how I created the wrapper code.  I figured it would work for the switches here because I used this method for other boards such as the VXI Tech 2601....counter and digitizers.
 
 
 
Where I run the code this is the error I get.. ...unhandled exception.   
 
If you know another way to get these serial numbers off the boards.....through NI or low level VISA call......that would be great too... Im just not sure how to go about doing that.   How would I go about doing it another way?
 
 
Thanks
Chan
 
 
0 Kudos
Message 5 of 8
(9,083 Views)
You could use the "Move_16" or "Move_32" commands in VISA, depending on if those are 32 bit or 16bit registers. Then just specify a VISA resource and an offset (the memory offset of those serial numbers). This should let you collect that information relatively easily.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 6 of 8
(9,072 Views)

Didn't know I can access the serial numbers this way.  Do I need to create a reference to some dll in visual studio to do this?  Do you have an sample code?  I haven't done any low level VISA programming before, Ill proubably have to read up a lil bit on it.  This can be done in C# right?  I'll give it a try....Id appreciate it if you can send me some links to some documents that can give me a lil crash course in VISA programming.  Thanks again.

 

Chan

0 Kudos
Message 7 of 8
(9,070 Views)
Hi Chan,

Yes, it may require a little bit of reading, but luckily we have some great resources for you.

Once you have NI-VISA installed (it looks like you already do) you can go to Start->Programs->National Instruments->VISA->NI-VISA Help.

Then, in the contents, you can select "Interface Specific", then "VXI". There are a couple of good sections on programming VXI in VISA.

You can also look in the section of NI-VISA Help called "Function Reference". It gives all of the C references you can use. There are files you'll need to include, and they are listed in the help files.

If you need more help with this, please let me know.

One last bit, if you go to the Index tag in the NI-VISA Help window move_16 and move_32 are some of the first things listed. There is help available on them there.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 8 of 8
(9,067 Views)