Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

NI 488.2 from VS2013 C++. How?

$
0
0

This has been very frustrating.

I'm trying to use a NI GPIB board to talk to an instrument. This needs to happen in C++ (not .NET) because it needs to run as a compiled executable in a tester platform.

I'm running VS Professional 2013. I have installed the latest GPIB software, version 17.0.0. 

 

In NIMax, interactively everything works fine. We just need to initialize, send a command and receive an answer. ibfind, ibwrt, ibrd is ALL I NEED. 

 

The latest version of the GPIB User Manual (2015), has this to say on p. 4-12: Microsoft Visual C/C++ (Version 8.0 or later): 

With Microsoft Visual C++ (Version 8.0 or later), to compile and link a Win64 console 

application named cprog in the Visual C++ x64 Command Prompt using the environment 

variable, "NIEXTCCOMPILERSUPP", type in the following on the command line:

cl /I"%NIEXTCCOMPILERSUPP%\include" cprog.c 

"%NIEXTCCOMPILERSUPP%\lib64\msvc\ni4882.obj" /MD

 

Frankly, this is B.S. 

 

I use:

#include "ni4882.h"

 

In order to have the code compile, I copied ni4882.h and ni4882.obj into a local folder. The code compiles, but none of the commands works. 

 

ibdev(0,6,0,T3s,1,0)

 

fails with -1. AND I DO NOT SEE ANYTHING IN GPIB TRACE in NIMax (whereas I see it when I run commands interactively). 

 

Can somebody please help:

- what do I have to do in VS 2013 to correctly link the functions so that they actually work?

- would linking to DLL work better?

 

I think NI documentation is really lacking here...

 

Thank you for your help!


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>