08-11-2013 01:41 AM
Hi.
I generated .NET Interop assembly DLL from LabView 2012 and have to use it in C#.
DLL - is from Agilent 34401A labview driver.
.NET Iterop assembly wizard generated Initialize function like this:
public static void Initialize(LVReferenceNumber VISA_32resource_32name, bool ID_32Query_32_40True_41, bool Reset_32_40True_41, out LVReferenceNumber VISA_32resource_32name_32out);
What should I write in my C# test to set GPIB / I.P. addres? from Labview or MAX my DMM is acessible using address: GPIB0::22::INSTR.
Also, I have to generate DLL to scope and have to use I.P. address to open VISA.
I understand that I have to set some value to variiable:
LVReferenceNumber VISA_32resource_32name
BUT, don't know exactly how to do it.
Can you help me?
08-11-2013 04:26 PM
I don't know why you went to all of the trouble to do this when you can easily use the IVI driver for this instrument.
08-14-2013 01:38 AM
Because I downloaded instrument driver from NI.com as Labview project with descrete VIs. And every VI has VISA in and VISA out. My question is how to create variable in C# that will hold VISA address - GPIB0::22:INSTR for example or I.P. address if needed.
08-14-2013 10:53 AM - edited 08-14-2013 10:55 AM
Again, why are you using LabVIEW driver when your programming language is C#.
It makes NO sense.
If you are using NI hardware, look at the programming examples that should have been installed on your PC.
08-15-2013 01:15 AM
I'm using Agilent, Tectronics, BertScope and Holzworth hardware.
standard instrument drivers from NI - labview VI.
Also, for new custom made instruments all what I get from manufacture is set of GPIB commands and maximum what i canask is to have labview VIs.
This is the reason.
And usage of .NET Interop assemble DLL in C# is standard procedure.
All what i need is to understand how to set VISA ...
08-15-2013 08:30 AM
@IgorKurtser wrote:
I'm using Agilent, Tectronics, BertScope and Holzworth hardware.
standard instrument drivers from NI - labview VI.
Also, for new custom made instruments all what I get from manufacture is set of GPIB commands and maximum what i canask is to have labview VIs.
This is the reason.
And usage of .NET Interop assemble DLL in C# is standard procedure.
All what i need is to understand how to set VISA ...
And as I wrote above, look at the programing examples that was installed on your PC by NI.
08-15-2013 09:52 AM
NYC.
Will you be so kind to give me a link to this manual (I failed to find it ...), assuming that LV installation path is standard istead of saying RTFM? Thanks in advance.
08-15-2013 10:10 AM
It is not in a manual. The links to the examples should be under the National Instruments NI-VISA in the Windows Start Menu
You may need to go back and install NI-VISA if you did not include the support for .NET Framework during the installation.
08-15-2013 10:17 AM
08-15-2013 10:46 AM - edited 08-15-2013 10:49 AM
Guys … Thanks for suggestion, but please understand that someone who started programming in LabView 6.0 knows why his question came to this forum.
I have tons of instrument drivers, written in LabView or just valuable code, which should be used from C#.
For this purpose I have to use .NET Interop Assembly. Or you can suggest better way?
Standard VISA example written in this manner:
using NationalInstruments.NI4882;
private Device device;
device = new Device((int)boardIdNumericUpDown.Value,(byte)primaryAddressNumericUpDown.Value,(byte)currentSecondaryAddress);
device.Write(ReplaceCommonEscapeSequences(stringToWriteTextBox.Text));
BUT, in NI manuals, usage of Interop assembly followed by:
using NationalInstruments.LabVIEW.Interop;
and only after I can use created DLL (with instrument driver):
using DmmAg3440aVer2;
The point is that Initialize VI, which nicely opens VISA session in LabView to this DMM, converted to function like this:
public static void Initialize(LVReferenceNumber VISA_32resource_32name, bool ID_32Query_32_40True_41, bool Reset_32_40True_41, out LVReferenceNumber VISA_32resource_32name_32out);
where GPIB address in some way have to be set in function argument:
LVReferenceNumber VISA_32resource_32name
And I don’t know how to deal with variables from this type.
So,
Try please with all respect try to answer on MY question …