cancel
Showing results for 
Search instead for 
Did you mean: 

labview and MS VC++ code

ASIM_BHATTI
Member

labview and MS VC++ code

Hello all

 

I want to interface my MS C++ code with LABVIEW graphic displays. What i am doing is that i receive data from NI DAQ cards using C APIs and do  lot of processing on this data.Now i want to display this processed data on labview displays in real time( just like NI DAQ card channels data is displayed on signal express labview real time).

 

 Kindly help me for this task as I am quite new to LABVIEW

 

THANKS

12 REPLIES 12
Been bitten by LabVIEW
Active Participant

Re: labview and MS VC++ code

I've never done it before, but I would imagine you would build a LV component (shared library).  But beyond that, I don't know.

 

It's a starting point though.

 

 

A

Knight of NI

Re: labview and MS VC++ code

If you are using NI DAQ cards there is probably no reason to deal with the C code unless this processing that you are doing cannot be done in C. You would need to describe what this "processing" is.

 

When you install DAQmx lots of examples are installed on how to do data acquisition in LabVIEW. You can simply open the Example Finder (Help -> Find Examples) to find them.

 

Also, please be more specific about what you mean by "real time". "Real time" is a very specific term. If you need "real" "Real Time" then you must use a real-time OS, and Windows is not one of these.

ASIM_BHATTI
Member

Re: labview and MS VC++ code

Hi

 

Yes i am using NI DAQ cards and the processing involves frequency domain beamforming,correlation etc.I have implemented this processing in C++ and i just want to display this processed data on LABVIEW graphics real time.

 

By real time i think i donot mean "real". Suppose if i am acquiring 200 ms data at a time, i need to process and display this data within 200ms before next 200 ms data is available to me.

 

THANKS

Highlighted
Fred_V
Member

Re: labview and MS VC++ code

Message contains a hyperlink

There may be a few ways to do this, but one way would be to package your C++ code into a DLL (C++ DLL Tutorial), and then use a Call Library Function Node VI to call into that DLL from LabVIEW.

 

Your LabVIEW program would take the incoming data and display that on native LabVIEW graphs or indicators. To further modularize your code, you could separate your signal processing code from your DAQ code. Then the LabVIEW code could capture and display, while the C++ code could analyze the data.

 

Hope this helps,

 

Fred Visser -- SystemLink R&D -- National Instruments
ASIM_BHATTI
Member

Re: labview and MS VC++ code

 

Thanks for reply. I think another possible way is to create LABVIEW dll and use it in my C++ code (I am using LABVIEW professional development system 8.0 with built in application builder). I have done some modifications (e.g. changing while loop with for loop with single iteration) in a example given by NI “Calling a LAbVIEW  built  DLL in C to Acquire, Analyze, and Present Data” to display my processed data.

 

The only problem I am facing is that whenever the function “present “is called in for loop, whole GUI fluctuates i.e. appear and disappear and I think this behavior is correct according to nature of this function.

 

But what I need is a GUI which will appear at the start, and after this only displayed data in it changes (just like graphical oscilloscopes).

 

In other words I want to build oscilloscope (in labview shared dll form) which will take data from my C++ code and display it in continuous mode.

 

Kindly help me.

 

THANKS

Fred_V
Member

Re: labview and MS VC++ code

Message contains a hyperlink

Hi Asim,

 

You may have stumbled upon one of the limitations of this approach. This forum discusses using user events to pass data between LabVIEW processes and other processes. That may address your issue, because with events you won't need to call all of the GUI setup code every time you need to refresh the data.

 

If that doesn't work, I still would recommend using LabVIEW to get and display the data, and your custom C++ code to analyze it.

 

A third option would be to use Measurement Studio as it has the ability to natively call LabVIEW style graphs directly from code.

 

Hope this helps,

Fred Visser -- SystemLink R&D -- National Instruments
josborne
Active Participant

Re: labview and MS VC++ code

I'd also reccomend Measurement Studio.  If you really need to use C++ for the processing, and you are good at it, might as well use the Measurement Studio components and keep it all within C++.

http://www.medicollector.com
ASIM_BHATTI
Member

Re: labview and MS VC++ code

Message contains a hyperlink

Hi

 

Thanks for your kind suggestions. I think it is not as easy as i thought initially. I have to do some hard work for my real time display

 

>>"If that doesn't work, I still would recommend using LabVIEW to get and display the data, and your custom C++ >>code to analyze it"

 I want to do the same, only thing i need additional is to display proceesed data (processing in c++)  real time (instead of displaying raw data from NI DAQ cards)

 

>>A third option would be to use Measurement Studio as it has the ability to natively call LabVIEW style graphs >>directly from code.

 

Problem is that i donot have Measurement studio. Will evaluation version work for my applications?

 

Best Regards

asim

Fred_V
Member

Re: labview and MS VC++ code

Message contains a hyperlink

Hi Asim,

 

You should be able to build a LabVIEW program that acquires data (using a NI DAQ card), passes that data to your C++ code (compiled into a DLL), and takes the output of that function and displays it within LabVIEW. Did you have a particular issue with this process? This forum discusses the DLL building process.

 

I'm not entirely sure the limitations of the evaluation version of Measurement Studio, but it's likely similar to the limitations of LabWindows/CVI. Likely, fully functional for 7 days, than with other limitations. Feel free to download the evaluation version and give it a try!

 

Hope this helps,

Fred Visser -- SystemLink R&D -- National Instruments