Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a simple GPIB C++ example for Visual Studio 2005?

Howdy,

I'm looking for a simple example to open a handle to an instrument, write a string to it, and receive a string from it -- nothing fancy, just the basics.  Sounds simple, but it's proven difficult to find.

I'm porting my code over to C++ in MS Visual Studio 2005 and simply looking for an example which will read and write strings to a device over GPIB.  All of the code examples and message posts I've found relate to using Measurement Studio, which I do not have and am not interested in purchasing. 

Thanks,
Chris


0 Kudos
Message 1 of 7
(8,287 Views)
Have you looked at the examples that ship with VISA, or the NI-488 driver? Those are your best bet. The VISA examples are installed by default in "C:\VXIPNP\WinNT\NIvisa\Examples\C". The one you probably want to look at is the "RdWrt" in the "General" folder. The ones that come with NI-488 don't use VISA, and are installed by default in "C:\Program Files\National Instruments\NI-488.2\Languages".
0 Kudos
Message 2 of 7
(8,265 Views)
Chris,

Thank you for contacting National Instruments.

If you are using a Windows XP system, there are many shipping examples. I was able to find a general GPIB read/write C++ example at the following location: C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\MStudioVC2005\Basic Gpib. The example is BasicGpibDlg.cpp.

Please let me know if you are unable to find this example. Hope this is able to get you started.

Have a great day.


Sarah S.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 7
(8,265 Views)
Thanks, smercurio_fc and Sarah_S, this is exactly what I needed. 

My major complaint with complex systems, such as NI T&M products, is that it's not always obvious where to get started.  Add that to the complexity of MS programming enviroments, and it's sometimes daunting!  I'm an RF engineer who still wishes I could write everything in good 'ol ANSI C...

These examples are a key starting point.  I'm surprised they were not called out in the NI Instrument Control Fundamentals tutorials.

Thanks,
Chris
0 Kudos
Message 4 of 7
(8,254 Views)

I'm not finding this sample code in the mentioned location and I want to connect to my GPIB-USB with c++. Can anyone help me with that? 

 

Thanks

0 Kudos
Message 5 of 7
(4,394 Views)

Try pasting the file path mentioned above in your file explorer.

 

C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\MStudioVC2005

 

The Documents and Settings folder is sometimes hidden so see if you can access it that way.

0 Kudos
Message 6 of 7
(4,379 Views)

Thanks for your response.

 

Here is what I have: 

 

C:\Users\Public\Documents\National Instruments\NI-488.2\Examples

 

I don't have "Languages\MStudioVC2005" and in the examples there is no file or directory  as MStudioVC2005. 

 

I want to be able to write into GPIB connector with my c++ code. Is there any other place I can look for the file? 

 

Thanks.

 

0 Kudos
Message 7 of 7
(4,372 Views)