Should I call C from LabVIEW or call LabVIEW from C?
I need to write some software and am trying to choose the best development environment. I currently use Borland C++ Builder to develop most of my software and have also used some LabVIEW occasionally. The new package I need to write has to provide several functions, some of which would be better in C++, some in LabVIEW and I am wondering whether to combine the two. So far, I have had a quick play around and called a very basic piece LabVIEW code, built into a dll, from some C++ code. I am about to try to reverse (create dll in C++ and call from LabVIEW) but would appreciate some advice on the advantages/disadvantages of each method.
Restrictions I have:
1. I will (probably) be using some hardware which will be supplied with C++ driver functions only. My interface with this card is the 'heart' of my system and is time-critical. Also, I need to assign a pointer to pass to this card (could I do this in LabVIEW?)
2. I wish to analyse data from the card using FFT and related functions so would ideally use the LabVIEW Sound & Vibration and Order Analysis toolkits. I need to use these in real-time where the data sampling rate is fairly high (frequency analysis to be done on 4 channels at once with each channel sampled at approx 100kHz).
To add to this, I would like to be able to create/modify the display screen at run-time - something which I am fine with in C++ but understand is very difficult in LabVIEW (I have only used LabVIEW for relatively...Debugging a C++ dll from LabVIEW
What I want to get a feel for is how easy it is to set up the ability to debug code both in labVIEW AND in a C++ compiler, say Visual Studio.
If we have a situation where we have a c++ dll which we are accessing from labVIEW is it possible to attach the process so that you can set breakpoints in both environments. Hence run labVIEW app and when dll gets called hit a Visual Studio breakpoint?
This is a new area to me and I have not found anything regarding debugging. Any comments would be appreciated.
Hi,...Labview from C/C++
My question is about how to call Labview VI/Global variables from C/C++.
We have a cRIO-9012 that runs under the VxWorks operative system.
Up to now, we were calling C functions from Labview, but we also need to
do the opposite.
- Can I call a VI from C/C++?
- Can I access Labview global variables from C/C++?
- Or is there a passive diagram, mapped to a C function, to be placed in
a VI that is triggered by the C function?
Please reverse alain and migeon for replying.
On Oct 15, 9:20 am, Alain Migeon <migeon.al...@tdcspace.dk> wrote:
> My question is about how to call Labview VI/Global variables from C/C++.
> We have a cRIO-9012 that runs under the VxWorks operative system.
> Up to now, we were calling C functions from Labview, but we also need to
> do the opposite.
> - Can I call a VI from C/C++?
> - Can I access Labview global variables from C/C++?
> - Or is there a passive diagram, mapped to a C function, to be placed in
> a VI that is triggered by the C function?
> Alain Migeon
> Please reverse alain and migeon for replying.
The two main methods for accessing the functionality of a Labview VI
from external C/C++ code are ActiveX and Application Builder. ActiveX
is available only on the Windows Platform. Application Builder comes
with the P...C/C++ in matlab and matlab in C/C++ ?
Is it possible to read C/C++ code in matlab and the other way around too?
as long as C or C++ are written in text files you can edit
them in the matlab editor. To see the special character of
C or C++ coding language, in the editor go to menus:
file>preferences>Edito/Debugger>language and on
popup "Language" select "C/C++".
This does not allow you to run the C/C++ code, just to
view it i nicer way...
saneman <email@example.com> wrote in message <frl846
> Is it possible to read C/C...change a LabVIEW array outside LabVIEW and keep updated in LabVIEW
change a LabVIEW array outside LabVIEW and keep updated in LabVIEW
I am Interfacing a FrameGrabber with LabVIEW using a frame grabber
The memory managment of this FG allow you to allocate your own Array
and to give a pointer to this Array to the memory manager.
Then when you acquire with the frame grabber, the acquired image will
be directly accessible in your array.
1.I give to the FG memory manager a pointer to the Labview array
through a SDK Dll function.
2. I run the acquisition
3. I display the array
My problem is that the Array is allways displayed with it initial
val...Problem for calling a Matlab generated C DLL with Labview
I am not familiar with DLL and I need help for using a Matlab generated C-DLL with a Labview application.
I have created a C-DLL from Matlab compiler version 4.8 and have deployed it on the host PC using MCRinstaller. So far so good.
When I used the VI for calling the DLL, I have the choice between 6 functions:
Do I have to use all of these functions?
In a first attempt, I have created a sequential loop in Labview to run the function Initialize then the function mlf and finally the function T...methods to call matlab in C C++ and call C C++ in matlab
I am reading the help documents about how to program matlab and C C++ together and my questions are a little bit general.
It seems that are several ways to call matlab in C C++ and another several ways to call C C++ in matlab. Please correct me if I am wrong or missing something when I try to list them.
To call matlab code in C C++, are there two methods available? The first one is Matlab engine and the second one is to use MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code.
To call C C++ in matlab, are there also two methods? The first one is to call funct...matlab labview
i am a new Labview user
i try to run a working function that i wrote in matlab on labview and i get error 1048
can u help me solve this problem ?
i have tried to chenge the variables, but it didnt help
i have notice that when i try to lanch reserve matlab function as "ones(1,5)" it's work fine
but when i chenge it back to Load1 it fails
the m.file is located in the directory used by matlab so this isnt the problem
where i need to put the m.file in order that matlab will call it from labview?
...LabVIEW and MATLAB
I am intersted in being able to "call" a certain MATLAB function (lets call it calculate_touch_point.m- the function returns one parameter - touch_point) and I am wondering how the whole interface between LabVIEW and MATLAB works.
If anyone can answer me shortly or has any documentation such as web links or pdf files regarding ti that issue that he can tell me about will help me a lot.
I am having a problem with sending the variables from LabVIEW to the script node.
I am getting an error:
Error 1047 occurred at LabVIEW: LabVIEW failed to send variable to the script server. Server:"" in Working with MATLAB - sending variable 18 04.vi
Do you know what am I doing wrong???
The version I am using is 8.0
Working with MATLAB - sending variable 18 04.vi:
http://forums.ni.com/attachments/ni/170/242505/1/Working with MATLAB - sending variable 18 04.vi
I removed : clear all; and also removed clc; and close all; just in case, but it still doesn't work.
by the way - The MATLAB version I am using is R2006a, and the LabVIEW version I am using is 8.0)
Do you have any other suggestions?
Working with MATLAB - sending variable 18 04.vi:
http://forums.ni.com/attachments/ni/170/242637/1/Working with MATLAB - sending variab...Re: LabVIEW and LabVIEW RT?
I will try to illustrate it with an example since it all will depend on the type of application you would like to implement. Let's say you would like to implement an application where you log data, maybe exchange data with databases and you acquire a bunch of data points at a time not performing any type of control and where high determinism is not needed. In this case LabVIEW for Windows work great. If you on the other hand would like to implement a closed-loop application where you need high determinism and reliability and will acquire data point by point you would use LabVIEW RT which is an add-on to LabVIEW. I.e. you need LabVIEW + LabVIEW RT when developing an RT application.
...C to Labview
I am fairly new to Labview and I have been given a project at work to convert an existing c code to labview. I will provide the section of the code That is giving me problems to see if any of you could assist me in writing it in labview.
void CPokey2Dlg::FindN(unsigned char Channel)
NFrac = FreqOne/(double)2.8e6;
NReg = int(NFrac+.5);
m_EditChannelTwo = NReg;
// if (NReg >= NFrac)
NFrac = (double)262144*(NFrac - (double)NReg);
// NFrac = int((262144*((double)NReg-NFrac))+.5);
if (NFrac <0)
NFrac = int(NFrac -.5);
NFrac = int(NFrac +.5);
// m_EditChannelTwo = NFrac;
NReg = NReg - 32;
iDividend = (int)NFrac;
m_EditChannelTwo = NFrac;
// format for register
SKY72300 = (unsigned char)(NReg >> 8);
SKY72300 = SKY72300 & 0x01;
SKY72300 = (unsigned char)NReg;
SKY72300 = (unsigned char)(iDividend >> 16);
SKY72300 = SKY72300 & 0x03;
SKY72300 = SKY72300 | 0x10;
SKY72300 = (unsigned char)(iDividend >> 8);
SKY72300 = 0x20;
SKY72300 = (unsigned char)(iDividend);
...LabView with Matlab
Hello! I am trying to write a subVI which does a lot of iterations like
I have tried using Newton-Raphsody but it seems to crash for some
iterations. So now I am trying to use Matlab Script or C for that
program. Of the two, writing a program in C seems to be a lot of work
for me as everytime I write it, I need to compile it as dll and run and
save it and then reload it.
I would like to know if Matlab is a good option or if you have any
ideas to suggest, please let me know.
Also, I would like to know any good books to learn Matlab script.
Here's the scoop. I ...How to interface the Labview and Simulink (Matlab) without using the "NI LabVIEW Simulation Interface Toolkit"?
I've been using the Labview for the data aquisition. And I also developed a controller in the Simulink (Matlab) environment. I'd like to control my application using both programs. How could I interface the Labview and Simulink (Matlab) without using the "NI LabVIEW Simulation Interface Toolkit"?
Thank you for posting to the National Instruments Discussion
If you are not using the Math Interface Toolkit, you may be
interested in using the MATLAB� Script Node. This allows
you to call MATLAB� commands using ActiveX and I you
can call your Simulink model from MATLAB� that way.
Here are some resources on how you can do this:
<a href="http://zone.ni.com/reference/en-XX/help/371361B-01/gmath/matlab_script_node/" target="_blank">MATLAB � Script Node LabVIEW 8.2
<a href="http://digital.ni.com/public.nsf/websearch/4475BC3CEB062C9586256D750058F14B?OpenDocument" target="_blank">How Can I Resolve MATLAB� script node and
Xmath Script Node Issues in LabVIEW?</a>
Hope this helps!
thank you for your reply. I will try to explore the option with the Script Node.
...If i have a labview .vi file(and labview) but i want to open it in a computer that doesn't have labview, how would i do it??
Okay, i have a made a labview program and save it as.vi.
Let's say that it is a program that when opened and you hit run it shows a sine wave.
Now if i wanted to open up the program without Labview, ( i don't need to modify it) on a computer that doesn't have labview. How would i go about doing this??
I am a new user of LabVIEW.
I have been assigned to acquire a signal from a sensor at a car.
However, all these signals must be filtered.
But I am not sure, what type of filter most powerful. Besides, as I
know, different type of signal needs differenct type of filter.
Anybody can help me to solve my problems.
Your kind cooperation is highly appreciated.
> Hi ALL,
> I am a new user of LabVIEW.
> I have been assigned to acquire a signal from a sensor at a car.
> However, all these signals must be filtered.
...Matlab DLL vs Matlab script in LabView
I have some question for those who successed to import the Matlab DLL's to LabView :smileyhappy: :
Is there significant time difference between processing the matlab routine thru the DLL and between the Matlab script in LabView ?
For the RT program that I am doing in LabView the time is very impotent, and as I measured , the code writen in Matlab script
takes 10...C/C++ in MATALB or MATLAB in C/C++?
I've been asking on the net how to use MEX properly so that I can use
C/C++ in MATLAB, but information is not forthcoming.
There seems to be a lot on using MATLAB in C/C++ but not the other
way around. I understand Mathworks is trying very hard to sell the
Matlab Compiler, but even so, why is it SO hard to get information
Or is it that I've missed something very fundamental, meaning that
I'm struggling over something that is actually quite easy?
Any thoughts and info would be great.
> I've been asking on the net ...How to write a C wrapper dll to export Matlab dll functions so that LabVIEW Call Library Function Node can use it?
Hello LabView developers,
I used LabVIEW to call Matlab m script to implement matlab MPC successfully. I wanted to use Matlab compiler to compile the matlab m script function into a c shared library .dll so that LabVIEW can call it without requiring Matlab installed on the PC.
I used MatLab R2007b with matlab compiler. I was able to generate a C shared library dll set successfully using mcc command.
However, from the header file, I see that the inputs and outputs of the function prototype are in mxArray. I need to change this data type to whatever that LabView Call Library Function Node can recognize.
I have followed a few examples in the forum, but none of them went through.
I use LabView 8.5. I have Microsoft Visual C++ Version 6 and Microsoft Visual Studio 2005. The compiler is in C++. Should I use a C compiler only to generate the C wrapper dll so that Labview can recognize it in the Call Library Function Node?
If anybody has gone through this successfully, I would like to learn from you on how to do it.
Hello LabView developers,
I used LabVIEW to call Matlab m script to implement matlab MPC successfully. I wanted to use Matlab compiler to compile the matlab m script function into a c shared library .dll so that LabVIEW can call it without requiring Matlab installed ...[ann] C/C++ interpreter Ch for labview released
Ch is a free C/C++ interpreter.
The source code for embeding Ch into labview is now available from the
More about C/C++ interpreter Ch can be found at
Any comments or suggestions are welcome
That's realy cool
...Calling a LabView DLL from a Labview VI
Hi, I have a vi that is calling a Labview DLL and they both have a same
subVI. If I drop that SubVI into the block diagram first then drop in the
Call Library Function Node, when I run the VI, the DLL would not work and
it did not give me any error. Does anyone know how fix this problem with
Labview? or is there some configuration that I can force the all of that
SubVI points into the DLL.
Thanks for your help,
...how to make my labview codings as a package for labview
I made drivers for some thrid party instruments, which is compatable for serial port and Ethernet. I have several vi's for that i cant able to share these vi's to my friends.
i just want to build one package of my driver, also i want to install these package to labview user library.
Tell me some good suggestion for this.
With warm regards,
The easiest way is to do a development distribution (File>>Save As.
If your needs are more complex, you can also try <a href="http://jkisoft.com/vipm/" target="_blank">VIPM</a>. I don't think the free version can do this, but it's worth it just for getting the OpenG code.
where i can find this development distribution ? is there option available in labview?
If you re using LV versions > 7.x, you can create an LLB by using the option Save As... in the Files menu.
You have to just open the top-level VI of that driver (or something) & go on to build the LLB. All other VIs will get added/bundled into it automatically. :smileyhappy:
In LV 7.x, I think it ll be under the Tools >> Build Source Distribution menu...
firstname.lastname@example.org wrote:Hello NI,
&nb...Labview.lib was not calld from a labview process
I am working with our labview programers to create a Labview DLL that will be called from Labview and VB6. The code works fine with Labview but I keep getting Fatal Error: Labview.lib was not calld from a labview process. I have checked the versions of development software and the runtime versions that we are using and they matche 8.0.1. We have also preformed a mass compile of the DLL with no change.
Are there any other steps that we can take to solve this problem???
<a href="http://digital.ni.com/public.nsf/allkb/A4C3AEF93240280A86256931006FB66C?OpenDocument" target="_blank">http://digital.ni.com/public.nsf/allkb/A4C3AEF93240280A86256931006FB66C?OpenDocument</a> Just to make sure you know of this article, I hope its a new one and else we can look further.<a href="http://www.groupsrv.com/computers/about566915.html" target="_blank">http://www.groupsrv.com/computers/about566915.html</a> Another discussion regarding the same error message.<a href="http://digital.ni.com/public.nsf/allkb/A4C3AEF93240280A86256931006FB66C?OpenDocument" target="_blank"></a> Message Edited by andre.buurman@carya on 06-04-2008 08:02 PM
<a href="http://forums.ni.com/ni/board/message?board.id=170&message.id=127655&query.id=62975#M127655" target="_blank">http://forums.ni.com/ni/board/message?board.id=170&message.id=...Installation of LabView 8 after LabView 6
Good afternoon everybody,
I've got a big problem with LabView. The fact is that I begin with this software...
I've just installed LabView 8 on a computer where LabView 6 was installed. Once the installation finished, I tried to launch a VI That was developped under the old version.
The problem is that two VI can't be found :
- AI Sample Channel.vi
- AI Acquire Waveform.vi
Therefore, I can't use anymore the program that was working before... What is the solution to get everything ok please ?
Thank you very much !
the VI will now...Is .NET DLL better to use than C/C++ DLL in labview?
I was wondering which one runs more natively in LabView8.5. C/C++ DLL or DLL by .NET ?Thank you.
You can use either kind, but .NET assemblies are much easier to work with. You can find some tutorials on working with both by searching this site.