Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any info on using GPIB with C#?

I want to use C# with my GPIB card but it is not clear to me how to go about it. C# does not have .h files so how would I handle these? Is there a simple example of programming this using C# anywhere?

Thanks,
Jesse
0 Kudos
Message 1 of 4
(3,687 Views)
Hi,

The easiest way is using Measurement Studio ActiveX controls, since the .NET enviroment provides some mechanisms to wrap the ActiveX controls for the new enviroment.

There are a couple of examples on the web for the GPIB ActiveX controls in .NET:

Performing Simple GPIB Communication in Visual C# .NET with Measurement Studio Active X Controls

Simple GPIB Communication in Visual Basic .NET with Measurement
Studio 6.0 ActiveX Controls


You can also check the beta program for Measurement Studio for .NET at www.ni.com/beta.

If you are not interested in the Measurement Studio components, you can still call the GPIB functions by creating a wrapper.

You can find references on the web on how to call unmanaged code (funcitons in dlls) from .NET.

The following posting on this discussion shows a wrapper for the NI-VISA functions. You can use this as a reference to create a wrapper: Discussion Forum

DiegoF
National instruments.
0 Kudos
Message 2 of 4
(3,687 Views)

Hi, I know am replying to a 9 yr old post , my queries are similar and link to "Discussion Forum" mentioned below might be renamed.. so i cant reach it.

 

I have a C# project using NI VISA . 

1. Can u let me know the DLLs / Assemblies tat i need to add as reference in my Project , so as i can reference the read/write functions from NI VISA.

 

2. When i read the NI VISA Programmer manual (as an example page 304), it mentions the C Syntax and Visual Basic Syntax , why it does not memtions the C# syntax. 

 

3. Can u point to some examples which show read/ write scpi commands using C# using NI VISA driver?

 

4. Is it that " call unmanaged code (funcitons in dlls) from .NET" still holds valid after 9 years or we have something from NI which help me to use directly to call .NET functions from my C# application.

 

0 Kudos
Message 3 of 4
(3,261 Views)

@na-ch wrote:

Hi, I know am replying to a 9 yr old post , my queries are similar and link to "Discussion Forum" mentioned below might be renamed.. so i cant reach it.

 

I have a C# project using NI VISA . 

1. Can u let me know the DLLs / Assemblies tat i need to add as reference in my Project , so as i can reference the read/write functions from NI VISA.

 

2. When i read the NI VISA Programmer manual (as an example page 304), it mentions the C Syntax and Visual Basic Syntax , why it does not memtions the C# syntax. 

 

3. Can u point to some examples which show read/ write scpi commands using C# using NI VISA driver?

 

4. Is it that " call unmanaged code (funcitons in dlls) from .NET" still holds valid after 9 years or we have something from NI which help me to use directly to call .NET functions from my C# application.

 


I am on Win7 PC.

The .NET DLLs are located in C:\Program Files\National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current

 

The example programs for using NI-VISA with .NET are located in C:\Users\Public\Public Documents\National Instruments\NI-VISA\Examples

You can get to the example programs from the Start Menu as well.

 

 

 

0 Kudos
Message 4 of 4
(3,256 Views)