Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB connection using C++.

I am trying to Communicate with a E4440a Agilent Spectrum Analyzer over a GPIB connection using C++. does any one know how to communicating using.

Also does any one know how to get this  header file to work

#include "decl-32.h" in c++ it says error no file or directory exist but i saw it in a few sample programs.

 

0 Kudos
Message 1 of 9
(7,197 Views)
Are you using the windows.h after this declaration. Try changing the order.
0 Kudos
Message 2 of 9
(7,171 Views)
Yes  windows.h is also included.
0 Kudos
Message 3 of 9
(7,167 Views)

From other post:

 

 


I found this as a location to find the file

 

  • Older versions of the drivers installed the files in the  partion in the following directory \Program Files\National Instruments\NI-488.2\Languages\Microsoft C
  • Newer versions of the drivers (post Vista support) install the files in the \Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\Microsoft C
  •  

    But when i try to go there i cant get all the way to that directory there are missing folders

    I am using M S visual studio 6.0    2005



    There is no MS Visual Studio 6.0 2005. You have either Visual Studio 6.0 or you have Visual Studio 2005. Pick one.

     

    As for the examples, have you made sure to actually install the examples?  This needs to be selected in the NI-488 installer. 

     

     

    0 Kudos
    Message 4 of 9
    (7,164 Views)
    We do have example programs that ship with the drivers: C:\Users\Public\Documents\National Instruments\NI-VISA\Examples\C for windows 7 C:\Documents and settings\Documents\National Instruments\NI-VISA\Examples\C for windows XP. Have you been able to build and run any of those examples?
    Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
    0 Kudos
    Message 5 of 9
    (7,147 Views)

    Your right my mistake its  MS Visual Studio 6.0

    I installed the  NI-488.2.2.7.3

    I copied and pasted a example  C++ program to communicate over the  GPIB and this was the error i got

     

    fatal error c1083: cannot open include files: ni488.h: no such files or directory

     

     

    I followed this instructions below but was not able to locate the folders after National Instruments\NI-488.2\Languages\Microsoft C

    just the ones in bold

     

     

    Solution:
    For development of GPIB programs in Microsoft Studio Visual C/C++, you must include the ni488.h file. Previously, the decl-32.h file provided this information to C compilers. Current driver versions still include a stub decl-32.h that references ni488.h. These files will be located in one of two places, depending on the version of your drivers:

    • Older versions of the drivers installed the files in the  partion in the following directory \Program Files\National Instruments\NI-488.2\Languages\Microsoft C
    • Newer versions of the drivers (post Vista support) install the files in the \Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\Microsoft C
    0 Kudos
    Message 6 of 9
    (7,141 Views)

    What operating system are you running?  The headers will install in different directories based on this, and once we know this, I can let you know exactly where these files should be.  In the meantime you can also do a system search to ensure that you do have these files.

     

    I would also recommend opening up an example shipping program that installs with the driver (not copying and pasting) and running this to ensure that this runs properly and can find the header.

    Message Edited by Kelly R on 03-29-2010 06:13 PM
    Cheers,
    Kelly R.
    Applications Engineer
    National Instruments
    0 Kudos
    Message 7 of 9
    (7,095 Views)
    My operating system is windows XP . Where would i find this example?
    0 Kudos
    Message 8 of 9
    (7,081 Views)
    You only need the 488.2 driver if you are using NI gpib hardware. You should be able to communicate with the GPIB device using the VISA driver. Were you able to find any examples in the VISA folder C:\Documents and settings\Documents\National Instruments\NI-VISA\ ?
    Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
    0 Kudos
    Message 9 of 9
    (7,022 Views)