LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Labview through C++ for Labview 8

I found this example code (http://sine.ni.com/devzone/cda/epd/p/id/858#0requirements) to acquire data using C++ code via Labview and was wondering if there are any changes I need to know about using it with Labview 8.5.1.  I am using the DAQ board USB-6225.  Thanks a lot.
0 Kudos
Message 1 of 6
(3,615 Views)

Hi there

 

Yes, you can. Attached is the modified example from http://sine.ni.com/devzone/cda/epd/p/id/858#0requirements, compiled with MS Developer Studio 6 and LabVIEW 8.5.1. You need to make slight changes. See the LabVIEW help for details about the LabVIEW ActiveX interface (see LV_Help.JPG in the attached archive).

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 2 of 6
(3,600 Views)
Thank you so much!  It is working.  I am using Visual Studio 2005 and did have to take out the lpctstr function at this line: pVI = pLV->GetVIReference((Path),(Password), false, 1); or else I got a runtime error, but other than that, it seems to be working great.  Now I just have to figure out how to program it to work with my custom VI.  That will be fun :).  Thanks again for your help.
0 Kudos
Message 3 of 6
(3,579 Views)
One additional question about this.  How do I know the data structures within the Labview so that I can access actual sample values from this waveform?  I have accessed other simple variables like, # of samples and can create an indicator that lists the values in a column called Y but I cannot figure out how to call them in my C++ program.  I would guess there is an array like "waveform out.y.0" for the first sample or something but I can't find any reference on that.  Thanks for any help!!
0 Kudos
Message 4 of 6
(3,566 Views)

Hi there

 

i don't know about the internal structure of waveforms, but i would not expect that any LabVIEW datatype is passed in a comprehensible way by COM/ActiveX. Use a common data structure like arrays instead.

 

You may want to use the debugger functionality of VC to see the data structure inside the C++ variant data.

 

Also take a look at the LabVIEW Help sections

 

Fundamentals->Calling Code written in Text-based Programming Languages

Fundamentals->Windows Connectivity

Fundamentals->How LabVIEW stores Data in Memory

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 5 of 6
(3,554 Views)

It is typically much easier to use a common data structure like chrisger says. The LabVIEW Help sections that chrisger recommended are also good resources. Also, you can use a Get Waveform Components function to break apart a waveform and get the array of amplitude values from it.

 

If you have Application Builder, you can convert your VI to a DLL, and call it via C++ that way. See the link below for more information calling a LabVIEW DLL.

 

http://digital.ni.com/public.nsf/allkb/70995EC2CA1B523386256DD4004F3DE6?OpenDocument

 

 

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 6 of 6
(3,546 Views)