10-01-2014 01:23 AM
I am developing a Test station using VXI based systems.
I am using Agilent E1401B Mainframe, with NI VXI-MXI-2 card.
I have never done any rogramming with VXI systems before, so to start, I write a simple code to read " *IDN? " from the cards installed in the mainframe.
I am using C# 2010 to develop the whole system.
Heare is an example code I wrote to access the VXI cards installed and try to read IDN?.
But it gives an exception "The given session or object reference does not support this operation.."
using Ivi.Visa.Interop;
namespace VXI
{
class Program
{
static void Main(string[] args)
{
ResourceManager ioMgr = new ResourceManagerClass();
string[] resources = ioMgr.FindRsrc("?*");
FormattedIO488 instrument = new Ivi.Visa.Interop.FormattedIO488Class();
instrument.IO = (IMessage)ioMgr.Open("VXI0::1::INSTR", AccessMode.NO_LOCK, 1000, "");
string cmd = "*IDN?";
instrument.WriteString(cmd, true);
string responseString = instrument.ReadString();
try
{
instrument.IO.Close();
}
catch { }
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(instrument);
}
catch { }
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ioMgr);
}
catch { }
}
}
}
Please someone help me to kickstart this VXI interface with Visual C#.
I am stucked here and dont know what to do next. searched all over the internet and couldnt find a good reference for C# in this problem.
could some plese help me with a sample code to read IDN of card installed in the VXI mainframe, with VXI-MXI-2 interface.
BR,
Pradeeban
10-01-2014 07:45 AM - edited 10-01-2014 07:46 AM
.NET 4.0 examples are located at C:\Users\Public\Documents\National Instruments\MStudioVS2010\DotNET\Examples
.NET 4.5 examples are located at C:\Users\Public\Documents\National Instruments\MStudioVS2012\DotNET\Examples
These examples are installed when you install NI-VISA on your computer.
Not sure if there are anything specifically for VXI
10-02-2014 01:53 AM
Hi Thanks For the reply.
I already tried those examples, but none of them explains me how to connect through VXI-MXI-2 interface and read from VXI device.
In the Measurement and Explorer I can see all my devices are listed.
Ex: VXI0::1::INSTR (VXI-MXI-2)
VXI::112::INSTR(HP E1466)
I want to talk to one of these device and get *IDN.
I use some example codes to using SCPI commands.
but is responds, like "ERROR = The given session or object reference does not support this operation./n"
please help.
10-02-2014 09:39 AM - edited 10-02-2014 09:48 AM
I haven't used MXI-VXI-2 in a while.
You might want to try http://www.ni.com/support/vxi/interactive_tools/int_comm_tools.htm
before programming in C#
EDIT:
You might want to check that you have the latest driver appropriate for your OS. http://digital.ni.com/public.nsf/allkb/63E23F33EB70A086862571EA00659E04
You might have to re-install the NI-VXI drivers to include support for .NET
10-02-2014 08:59 PM
Hi,
This link seems to be quite informative. Thank you for sharing this.
From this I understood that the devices i am usung are truly Register based, on which I was trying message based communication.
I ll try to do some register based opeartions.
Thanks.
🙂