Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Instrumentation Control of Tektronix Scope with NI-VISA

Hey all,

 

I'm conducting some research that uses a Tektronix DPO5204 Oscilloscope, and I've gotten it to configured through NI-VISA to talk to a PC (tested through the VISA Test Panel, sent a *IDN? command, and returned info from the scope correctly). Can also ping the device through a prompt window.

 

I have tried loading up the NI-VISA examples that came with NI-VISA version 17.5, but loading these up in Microsoft Visual Studio 2017 has yielded errors, which I'm sure has to do with the code being written in 2005 and we are now using a much later version of Microsoft Visual Studio. I was wondering if there was any up-to-date examples that I could look at for basic communication between the Scope and the PC. I have tried looking at the NI-VISA User Manual as well as the Programming Guide, but the examples don't seem to work in there either. Thanks all.

0 Kudos
Message 1 of 5
(4,473 Views)

Have you taken a look at this knowledgebase article that outlines how to install the examples with NI-VISA and to find where they are located? Or are these the examples you were referring to?

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8r4SAC

Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(4,430 Views)

These are the exact examples I was trying to get through.

 

I have gone through the installation process and enables those examples to be installed, and I can load any one of the projects in Microsoft Visual Studio just fine (apart from the fact that it upgrades the code in order to work in MVS 2017, not sure what this does exactly but i'm sure it just makes it compatible with MVS 2017).

 

Whenever I load one of these files in MVS, and try to build the solution, it gives many errors (200+), the first of which are the 

#include <visa.h>

and other #include arguments. I've tried adding this header files in manually, and this works (adding the visa.h header file gets rid of that error) but then it says it cannot find the visatype.h file, which I'm guessing is called in the visa.h header file itself. So then I tried adding that one in manually, and it does not get rid of the error this time. Not sure what is going on here.

 

Am I on the right track? All I'm trying to do is talk to the scope to get some sort of info from it, like acquiring waveforms and whatnot. Anything just to make some progress would help.

 

0 Kudos
Message 3 of 5
(4,427 Views)

Okay, so I've worked through things a little more, and figured how to call the proper location of the header files, or I can simply copy them over to the directory in which the .c file is and point them to that location, the next problem I'm having is the following, from console when I try and compile the .c file:

Undefined symbols for architecture x86_64:
  "_viClose", referenced from:
      _main in FindRsrc-c53f71.o
  "_viFindNext", referenced from:
      _main in FindRsrc-c53f71.o
  "_viFindRsrc", referenced from:
      _main in FindRsrc-c53f71.o
  "_viOpen", referenced from:
      _main in FindRsrc-c53f71.o
  "_viOpenDefaultRM", referenced from:
      _main in FindRsrc-c53f71.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Tried searching this, and couldn't find anything on it.

0 Kudos
Message 4 of 5
(4,422 Views)

Tried working in the Windows Visual Studio environment instead and the code worked. Not sure why it would be different, but I can now run the FindRsrc.c file from visual studio, and it pops up with all my NI-VISA devices on the prompt.

0 Kudos
Message 5 of 5
(4,415 Views)