05-14-2019 10:45 AM
05-14-2019 04:51 PM - edited 05-14-2019 04:52 PM
@muneerkun wrote:
So, only if LabVIEW can deal with C codes, it will be a great alternative. I thought that any software is initially made using C codes and instructions. So, I thought any compiling software can compile C codes in the first place.
I can't be sure that MS Word or MS Excel are written in C(++) but the chance is pretty good and they don't compile C(++) code either! Just as many 100'000 other programs out there.
So your assumption is just that, an assumption and a wrong one at that. While it would be theoretically possible to add a full C node in LabVIEW and integrate a complete C compiler in it too, this is not really something most users want. Most C programmers do not want to use LabVIEW and most LabVIEW programmers do not want to use C, as that is one of the reasons they started with LabVIEW.
Also there are many not so trivial problems that would be pretty difficult to solve. A real C program (unlike the Formula Node) does require the programmer to allocate memory and deallocate it again afterwards, while the whole idea behind LabVIEW is that memory is usually fully managed in the background for you by LabVIEW. This is in fact one of several reasons that the Formula Node only supports the functionality it does. Make it simple enough to not introduce LabVIEW untypical things like having to worry about proper memory allocation and deallocation, converting between C datatypes and LabVIEW datatypes, worrying about C runtime specific flavors and gotchas, etc. etc.
05-17-2019 11:08 AM
@rolfk wrote:
@muneerkun wrote:
So, I thought any compiling software can compile C codes in the first place.
I can't be sure that MS Word or MS Excel are written in C(++) but the chance is pretty good and they don't compile C(++) code either! Just as many 100'000 other programs out there.
Thank you, Rolf, but both MS Word and Excel are not compiling softwares! I made my assumption from the fact that C++ compiling programs (such as Visual Studio) can also compile C code. Even Arduino IDE can compile C and C++. Also, MATLAB can compile C using "mex function".
Anyway, I'm convinced of what you said in your last paragraph. Actually, LabVIEW graphical code is very great in programming, but it can't build codes on target embedded systems. It can only run codes using modules such as MakerHub LINX which is still limited for certain embedded systems like Arduino. That's why I still need C.
Thank you again.
05-17-2019 12:38 PM
You could use LabWindows if you if you want to say in the NI ecosystem. If you are wanting embedded type targets, there are embedded versions of the cRIO such as the System On Module and Single Board options.
In the end, I've had several places where the easiest thing to do was create my own peripheral using an MCU and serial communications to LabVIEW over through VISA calls.
05-17-2019 01:22 PM
I go the opposite way LabVIEW to text based langues, but the answer is still the same. Create a DLL. Once you have your c code, just compile it as a dll, and then import that into LabVIEW. You'll be able to call every function you have created directly in LabVIEW. Yeah, you do need to programs, but it doesn't make it any harder to do.
05-27-2019 08:58 AM
Thank you MHawk and randomguy77