LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW RT programming Options

We are considering using LabVIEW RT for an upcoming project but from reading information on the NI web site it looks like the only progrmming options are LabVIEW or VISA. Does anyone know if you can use LabWindows C or any other C/C++ compiler with the LabVIEW RT OS? Can you call C/C++ code (DLL's) from LabVIEW RT? Do standard LabVIEW formula nodes work in the LabVIEW RT OS? Also, does anyone have any bench mark test comparing LabVIEW with C/C++. I was told at a NI symposium that LabVIEW runs as compiled code and can run as fast as C but all of our test (LabVIEW 6.1 VS MS C++) indicate that MS C++ executes about 2X faster than equivalent LabVIEW code.
0 Kudos
Message 1 of 5
(4,226 Views)
Hi Davida2000,

I am curios about your tests that indicate MS C++ is twice as fast.

Depending on what you are attempting to do, this is correct, but this is for very specific tasks where the native LV data types are not the best fit.

If you are talking about rading values, doing some math, and driving an output, LV is quite fast running under RT. I have done 12 PID loops with customer specified transfer functions at 100 Hz with time left over.

What are you trying to implement?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 5
(4,226 Views)
Hi Ben,

Thank you for your response. Let me add a little background info... Our upcoming project requires a real-time OS, DAQ, data compression, etc. We would like to use NI LabVIEW RT as the real-time OS based on very favorable past experiences and successes with NI hardware and software. We do however have a requirement to support custom boards (which I understand we can do under LabVIEW RT using VISA) and to implement a data compression algorithm in software. We would like to use C/C++ for our data compression algorithm but so far I have not been able to confirm that this is possible under LabVIEW RT. The information I have been able to find on the NI web site has been confusing. For example in the LabVIEW RT FAQ section it says:

Can I use LabWindows/CVI or any other external compiler to program the RT Series hardware?

Not at this time. However, as of LabWindows/CVI 6.0, you can communicate with your 7030/60XX RT hardware using shared memory. To do this, use the LabVIEW RT communications functions under toolslib\cvirtsup. You can also build dll's in LabWindows/CVI that can be called by LabVIEW RT. To do this, set your dll target settings to build a dll for LabVIEW Real-Time only.

The response to the above question starts out by saying there is no external compiler for LabVIEW RT and ends by saying you can write LabVIEW RT dll's using LabWindows/CVI (an external compiler). Does LabWindow/CVI have a LabVIEW RT cross compiler that creates LabVIEW RT compatible dll's? I was hoping that someone who has actually tried writing LabWindow/CVI dll's for LabVIEW RT could confirm that this code will download and run on a LabVIEW RT system (please refer to the first part of my question).

Anyway, to address your question:

As I mentioned above we have to implement a data compression algorithm in software. Since we are unsure if we can use C/C++ with LabVIEW RT we tried to implement the algorithm in LabView 6.1 Our algorithm ran many times faster in MS C than it did in LabVIEW. Initially we felt that this was because we had to do a lot of bit manipulation (which we find very cumbersome and inefficient in LabView) so we decide to do a very simple test where we would simply add to numbers together in a for loop. We added 1 to a number incrementing it from 0 to 1,000,000,000 and timed how long the loop took. This is the test where MS C ran roughly twice as fast as LabVIEW.

Any comments on our test comparing C and LabVIEW and/or programming options under LabVIEW RT would be greatly appreciated.

Dave.
0 Kudos
Message 3 of 5
(4,226 Views)
Hi Dave,

Yes you found the soft spot i.e. bit stuffing etc.

I will assume this custom board of yours requies the data compression and therefore the data compression cannot be moved of board, defered etc.

LV can crank out quite good performance just the same. Have you bench-marked the app and know that the compresion work performance jeopardizess the determinism?

Re: the answer you cited above.
First let me say that I have not done this myself, in RT yet...
I do not think you can do CVI in RT because only a subset is available.

It sounds like you can build your dll and target it for RT.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(4,226 Views)
Dave:

I do know for a fact that you can use CVI to create DLL's that run on LVRT. It sounds to me like the FAQ is somewhat self-contradictory, but I think what it is trying to say is that no external (read: no non-NI) compiler is supported.

As long as you can keep your routines to C (you mentioned C++ but it won't work for you here) this will be fine. We've done tests with a DLL calling VISA, and it worked fine. Obviously calling VISA directly from LabVIEW works fine too, but I just thought I'd give you an idea of a specific DLL test that we have done.

Export your functions from the C DLL and LabVIEW can call them just fine, just like it does on Win32 or anywhere else.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Ins
truments
0 Kudos
Message 5 of 5
(4,226 Views)