Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-488.2 with C#.Net

Want to use instrument drivers directly with C#.Net (NO Measurement Studio, PLEASE).
Plan is to use dllimportattribute. Tried to add ke2000_32.dll (for Keithly 2000 DMM) as a reference to Visual Studio.Net project, but VS choked; said it couldn't create a wrapper. How do I reference the dll?
0 Kudos
Message 1 of 10
(4,960 Views)
Hello wdk,
The best way to go about this would be to use the Measurement Studio components. Since this does not appear to be an option for you, lets give it a shot!

Unfortunatly, we currently do not have a language interface file available to let you do ib level commands in .NET.

I have encountered an example of doing VISA calls in C#. If you want to use the VISA C functions in Visual C#, you can use the Visual C# DllImport external method declarations in the attached example file.

I also need to mention that this is completely unsupported as it is not an official NI release.


Best Regards,
Aaron K.
Application Engineer
National Instruments
0 Kudos
Message 2 of 10
(4,960 Views)
I'm attempting to control a xantrex xfr power supply with C#. I downloaded XanM9B_MS.msi (IVI / labwindows) from the NI website and installed it. That created XanM9B_32.dll for me.

The C# code:

using System;
using System.Runtime.InteropServices;
namespace GpibComm
{
///
/// Summary description for XantrexXfrWrapper.
///

public class XantrexXfrWrapper
{
[DllImport("XanM9B_32.dll")]
public static extern System.Int32 XanM9B_init(
string resourceName,
bool idQuery,
bool resetDevice,
ref System.UInt32 vi
);
}
}

It compiles, but at runtime doesn't work.

Any ideas?
0 Kudos
Message 3 of 10
(4,960 Views)
Are there any plans where NI will officially release a .NET C# interface for the NI 488.2 libraries?

If so, when will that happen?

Jaime
0 Kudos
Message 4 of 10
(4,960 Views)
actually, I've solved the problem, and the above C# code that I posted earlier seems to be working fine.
Message 5 of 10
(4,960 Views)
Yes, National Instruments is currently working on a NI-488.2 native .NET interface. You can read all about it at
http://volt.ni.com/niwc/common.jsp?page=mstudio_tech
0 Kudos
Message 6 of 10
(4,960 Views)
i was thinking of just the libraries and not measurement studio.

I got the GPIB-ENET/100 controller and wanted to use the NI488.2 library to control my GPIB equipment using C#.

Jaime
0 Kudos
Message 7 of 10
(4,960 Views)
Aaron,

How would you go about opening a connection, sending a query, and closing the connection for an instrument using the interopable VISA libraries?

Do you have any sample code?

Thanks

Jaime
0 Kudos
Message 8 of 10
(4,960 Views)
For now, the only way to access the NI-488.2 .NET library is through the Measurement Studio beta program. However in the future, NI will ship this same API in a driver CD, so you'll get it w/o MStudio as well. If you do sign up for the beta program, you are welcome to use my name as the NI contact.

Regards,

Azucena Perez
0 Kudos
Message 9 of 10
(4,961 Views)

Hello Its been many years.

 

Are we able to use NI-488.2 native commands on current released?

I wanted to use old ib commands on C#.

 

Please help.

 

Regards,

Raymond

0 Kudos
Message 10 of 10
(165 Views)