Example Code

How to develope a digital scope using NI PCI 5112 and VC++ 7.0.

Code and Documents

Attachment

This example shows you how to develope a digital scope using NI PCI 5112 and VC++ 7.0. There is a SCOPE Soft Front Panel comes with NI PCI 5112, but it's 25M in size. I was surprised when I saw it. Using VC++ and drivers come with the PCI 5112 you can develope powerful digital scope which is faster and smaller in size. I fixed signal displaying bug on November 15th 2006, so it won't draw out of the scope screen.

I posted all the source code in a zip file. anyone can use it if you have any question , don not hesitate to contact me.

This program may not meet your requirement, but it shows you how to combine C++ and C, and a how to invoke NI functions in PCI 5112 libraries.

All the parameters related to NI 5112 is in ScopeParam.h and ScopeParam.cpp. I set all of them as global variables.

There are 4 important functions in this program:

ConfigScope() , you can change parameters in this function to meet your requirement.

DoDigitalization() is function to initialize an acquisition and fetch data then display. I use a timer to call it repeatedly

OnCbnSelchangeComboMtb() is the function adjust Time base division (in microsecond) by reseting sample rate

OnHscroll() is time delay which adjust trigger delay.

Complie notes: I have to select not use the precompiled header function in project 's properties setup. I also include ivi.lib and niscope.lib in my project. If you need to recompile it you need to change the path of these 2 files accoding to you installation of NI5112.

Test Note: Connect Channel 0 of PCI 5112 to a sine wave (-2.5~ +2.5 ) , you can test it.

NOTE: We don't need Measurement Studio Visual C++ Support 1.0 to develop this program. I have to select an application software to post this article. You just need Visual C++.net 2003 (I call it VC ++ 7.0 ) and drivers comes with NI PCI 5112 .

Other requirements:

Visual studio c++.net 2003

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors