Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to communicate with GPIB instruments using the NI GPIB-USB interface. How do I begin to write code in Visual Basic that will allow me to communicate with the interface and start talking to my machines?

Solved!
Go to solution

TesTech wrote:

Thanks for your response. The Imports VB = Microsoft.VisualBasic statement was listed in the DMMSimple example


I just happened to notice this when I came back to this thread to refresh my memory. Did you open this from the "C:\Program Files\National Instruments\NI-488.2\Languages\Visual Basic\DMMSimple" folder? That example is for VB 6, not VB.NET. The .NET examples are in the "C:\Program Files\National Instruments\MeasurementStudioVS2008\DotNET\Examples" folder. In there you will see a shortcut to the VISA examples, which are located in the "C:\Documents and Settings\All Users\Documents\National Instruments\NI-VISA\Examples\DotNET3.5" folder. The example you should look at is the SimpleReadWrite example. Within there is a C# version and a VB.NET version. 

 

Please make sure this example works before proceeding any further. 

0 Kudos
Message 11 of 22
(4,131 Views)
I know what you mean about being busy, mfg slammed me pretty hard this week so not much time for programming projects. Anyway, if you do have the time, I would greatly appreciate any advice or examples that you have to share. Thanks.
0 Kudos
Message 12 of 22
(4,103 Views)
Did you read my last reply? I was confused about which example you were actually opening. As I noted, the DMMSimple example that I'm familiar with is a VB example, not a VB.NET example. The VB.NET examples can be found in the "C:\Program Files\National Instruments\MeasurementStudioVS2008\DotNET\Examples" folder. In there you will see a shortcut to the VISA examples, which are located in the "C:\Documents and Settings\All Users\Documents\National Instruments\NI-VISA\Examples\DotNET3.5" folder. The example you should look at is the SimpleReadWrite example. Within there is a C# version and a VB.NET version. Open the "SimpleReadWrite" example and make sure this works before you go any further. 
0 Kudos
Message 13 of 22
(4,098 Views)

Sorry, I'm still learning how to use the forum as well and did not look for page 2 replies.

 

The path C:\Program Files\National Instruments\MeasurementStudioVS2008\DotNET ends with an Assemblies folder, there is no Examples folder and nothing in assemblies is a shortcut. Likewise, C:\Documents and Settings\All Users\Documents\National Instruments\NI-VISA\Examples\DotNET3.5 contains no DotNET3.5 folder. Only a folder for C and VB6 (nothing useable in VB6\General folder). In the C folder\General there several RdWrt examples: RdWrt (C file), RdWrt_MSVC (DSP file), RdWrt_CVI (PRJ file) and RdWrt_MSVC_VS2005 (VCPROJ file). But I'll bet none of these are what I need are they?

0 Kudos
Message 14 of 22
(4,094 Views)

Did you actually install the .NET support? Here is what should be selected in the NI-VISA installer:

 

 

 

NOTE: If you have just VS2008 then you can omit the .NET 2.0 support. 

Message Edited by smercurio_fc on 01-27-2010 11:25 AM
0 Kudos
Message 15 of 22
(4,091 Views)

OK, you're trying to use it at the GPIB-level. VISA would be one level higher. The version of NI-GPIB that you have had assemblies for .NET 1.1. NI-GPIB 2.6 was the first version to include assemblies for .NET 3.5. The assemblies you  have may work, but you're better off upgrading to the latest version of NI-488.2.

 

The examples you have installed with the version of NI-488 that you have are probably in the C:\Program Files\National Instruments\MeasurementStudio\DotNET\Examples\Gpib. That's just a guess on my part since I don't have .NET 1.1 support installed, and I have a later version of the NI-488.2 driver. The specific example you should open is called "SimpleReadWrite". Again, there should be a C# and a VB.NET example. 

Message 17 of 22
(4,079 Views)
Solution
Accepted by TesTech

Thanks for your help. I have located the simple r/w example and it works with my instrument. Now my task will be to attempt to interperate what I am looking at. I'm sure that I will have a lot of other questions. Shall I continue with this thread or open a new post.

0 Kudos
Message 18 of 22
(4,049 Views)
If you have a question regarding the specific use of an instrument you should probably start a new thread so it doesn't get ignored because people still think it's within the same subject of this thread, which is basically what's needed to be able to talk to instruments using VB.NET.
0 Kudos
Message 19 of 22
(4,046 Views)

Hi, you said " Did you open this from the "C:\Program Files\National Instruments\NI-488.2\Languages\Visual Basic\DMMSimple" folder? That example is for VB 6, not VB.NET." So does it mean I can communicate in VB? How about using the Visual Basic Editor in any Excel spreadsheet, is this possible? Tks.

0 Kudos
Message 20 of 22
(3,187 Views)