Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data from DAQ card (6042E) to C++ code

Hello niDAQ/Labview users,
I have a C++ code that uses VTK to perform the following: Based on the mouse position, a ball on the screen moves (almost real time.).
I now want to simulate the movement of the ball using data from an LVDT (which I plan to acquire using a PCI - 6042E card).

I have Labview 8.2 and Visual studio 2005 (with measurement studio) installed on a windows XP machine.
I have used a signal generator and tested that my laptop can infact get the data using the measurement studio test project.
But I cannot find any info on accessing the data coming through the card using C++ code.

 How can I get the data from the LVDT (analog voltage input) and feed it to my C++ code?
Also should I use measurement studio to generate the part of the code that will do the data acquisition or does that portion need to be hand coded?

Any help is appreciated.
Thanks,
Joby.
0 Kudos
Message 1 of 4
(8,417 Views)

Hi LV_NewUser,

There are example programs that show you how to acquire data from your DAQ device using DAQmx drivers that ship with Measurement Studio. You can access these from:
Start»Programs»National Instruments»Measurement Studio»Visual C++ Examples

As far as generating the code, the answer is you can auto-generate the code to do the acquisition from your DAQ card.
The following tutorial walks you through how to do this in C#:
Developer Zone Tutorial: Using the DAQ Assistant in Measurement Studio

Hope this helps.

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 2 of 4
(8,383 Views)
Hi Jervin, Thanks for the tips. Unfortunately this does not answer what I intend to do. The wizard helps me to create a data aquisition system very easily. I am not sure where  I should add functionality to my code.

When I create a new project (let's call it TRIAL) using the wizard, it creates around 19 files in the project. 7 header files, 3 resource files, 1 bmp, 4 source files 2 DAQmxTask files and 1 readme file.
Where would I add code to say add two numbers. I could not even locate the main() {} function.

I guess since I am used to C++ and not VC++ I am having this difficulty.
Is there a manual or guide detailing integration of regular C++ code with a measurement studio Project?

Thanks,
Joby.

0 Kudos
Message 3 of 4
(8,321 Views)
Hi LV_NewUser,
 
The reason you don't see the familiar functions of C++ is because of how VC++ designed. A lot of the code that is auto-generated is generated even with just VC++ without Measurement Studio (which adds the NI specific stuff).
 
If all you are looking to do is add code to the program, do a search (Search in Files: Ctrl+Shift+F) in Visual Studio for "TODO" and make sure that you are searching the entire solution.
One good place is the "OnInitDialog" function in TrialApp.cpp file, or the "InitInstance" function of the DAQmxTask.cpp file.
Also, take a look at the readme file, it has a high level overview of the different files.
 
To get a better understanding of what all those different files do, I would really encourage you to read up on Visual C++. There are plenty of good "Intro to" books on the subject.

Hope this helps.
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 4 of 4
(8,299 Views)