Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Where do I find a tutorial/ code samples for GPIB control with Visual Basic?

I recently purchased a GPIB-USB-HS unit that comes with the NI-488.2 software. LabVIEW is out of my budget, Measurement Studio is way out of my budget. I do have Visual Basic 2005 Express Edition.
I am looking for relevent tutorials, code fragments and advice to help me learn how to run the GPIB through a Visual Basic 2005 Express application.
Such advice may include reference book recommendations.

Thanks,

From the foot of Pikes Peak,

George Ott
0 Kudos
Message 1 of 36
(7,848 Views)

I asked this very question a few weeks ago. The answer from NI is that there isn't anything YET.

There is an example project for VB2003 but there are errors when pulling into VB2005.

You might want to look into using VISA-COM. I haven't had time on my job to try it out.

Makoto here on this msg board provided the attached CHM Help file that would be helpful to get us started. It looks promising.

 

0 Kudos
Message 2 of 36
(7,832 Views)
Unfortunately the VISA COM help provides C++ and VB6 syntax only on each Method/Prop page, except for the beginning Getting Started pages.  You must replace each VB6 syntax with VB.NET in your mind.  (Though the syntax is very common for VB6 and VB.NET.)
 
I also here attached an example VB.2005 project that uses VISA COM through the latest VISA COM 3.0 interfaces. (Requires VER3.x for NI-VISA.)  The example shows how to write/read, convert a string response to double, and handle I/O exceptions.
Although I generated this project with VB.2005 Professional Edition, I believe it can be opened with the Express Edition.
 
Hope this gets you started.
Makoto
0 Kudos
Message 3 of 36
(7,810 Views)
George,

It should not be necessary to use VISA-COM, you should be able to use the .NET assemblies natively with Visual Studio 2005.

You should be able to open the example programs which install with both NI-488.2 and NI-VISA.  I have tried several of these examples, including examples from each driver, and had no problems using them in Visual Basic 2005.  I also create a very small VISA application in VB 2005 just to make sure it would work.  You should be able to find the examples in a path similar to that shown below:

C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples

These are VS 2003 examples, but the automatic conversion into 2005 seemed to work fine when I tried it.

If you do not see this folder on your computer, re-run the NI-488.2 and NI-VISA installers, and ensure that you have selected to install support for .NET.

Please let me know if you have trouble using these examples.  I did open these in VS 2005 Professional, instead of Express.  If you have trouble, please include details of the problems you are experiencing, and I will see if I can replicate the problem on my own computer.

Jason S.
Applications Engineer
National Instruments

Message Edited by JasonS on 04-10-2006 09:40 AM

0 Kudos
Message 4 of 36
(7,796 Views)
Hello again.
Jason S, I'd follow your recommendation but I don't have, nor do I wish to purchase, the Measurement Studio software.

Regards,
George
0 Kudos
Message 5 of 36
(7,782 Views)
Hi,

this is quite easy to use GPIB with VB6 VBA/Excel or VBScript all you
need is an API which is dedicated to port I/O and is written in a
Windows DLL with COM interface ...

The best would be that it recognizes transparently GPIB controllers
from different manufacturers ... to make portable programs ...

Then you can program with output/enter instructions ...

The only one I know is free for one GPIB address and is named labtab
....

If you find other solutions, I am interested ...

FG

0 Kudos
Message 6 of 36
(7,775 Views)


@George in Colorado wrote:
Hello again.
Jason S, I'd follow your recommendation but I don't have, nor do I wish to purchase, the Measurement Studio software.

Regards,
George


George,

The files that Jason S is referring to are installed when you install NI-VISA. You don't need to buy Measurement Studio. I did this just yesterday, and we don't have Measurement Studio either.

 

 

0 Kudos
Message 7 of 36
(7,771 Views)
Hello again,
JasonS, I took your suggestion and tried to re-run the NI-488.2 install with the .NET Framework 1.1 Language support. Much to my dismay, I got the following error message:

"Microsoft .NET Framework 1.1 not present"

And indeed it is not, I have Microsoft .NET Framework 2.0.

Any suggestions?

Curiously yours,
George
0 Kudos
Message 8 of 36
(7,671 Views)
Microsoft .NET Framework 2.0 is NOT an upgade replacement of existing 1.1, therefore it has no power to operate .NET 1.1-based software.  You need install the .NET Framework 1.1 (and hopefully its service pack)  over the .NET Framework 2.0.
 
Makoto
0 Kudos
Message 9 of 36
(7,667 Views)
I agree with Makoto.  If I check in "Add/Remove Programs" I have three items related to the .NET framework: version 1.1, version 1.1 hotfix, and version 2.0.

The .NET Framework is usually obtained through Windows Update, but I am not sure if it will allow you to select 1.1 if you already have 2.0 installed.  If you cannot obtain it through Windows Update, it should be available from Microsoft at the following link:

.NET Framework Version 1.1 Redistributable Package

.NET Framework Version 1.1 Service Pack 1

Jason S.
Applications Engineer
National Instruments

Message Edited by JasonS on 04-26-2006 06:47 AM

0 Kudos
Message 10 of 36
(7,657 Views)