Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

how to run a labview program faster?

i am running a program in labview which consists of for and while loops.the maximum speed the loop is running is 2000 cycles/sec or close to that. how do i speed up the operation?
0 Kudos
Message 1 of 3
(3,856 Views)
Dear SivaSwetha,

Thank you for contacting National Instruments.

To address your question, there are three typical areas where you can reduce execution time: I/O (files, instrument control, data acquisition), Screen Display (efficient controls and displays), and Memory Management (efficient use of arrays, strings, and data structures). Other factors, such as execution overhead and subVI call overhead, usually have minimal effects on execution speed.

If you have I/O in your program, the best method of reducing the I/O overhead is to minimize the number of I/O calls you make in a VI. Structure the VI so that you transfer larger amounts of data with each call instead of making several I/O calls that transfer small amounts of data.

Updating controls on the front panel is another time-consuming task in a VI. To minimize this overhead, keep front panel displays simple and try to reduce the number of front panel objects. Also disabling autoscaling, scale markers, and grids on graphs and charts improves their efficiency.

Whenever using loops in an application, there are a number of issues. Avoid placing calculations in loops if the calculation produces the same value for every iteration. Instead, if you can, move the calculation out of the loop and pass the result into the loop. Also, avoid accessing local and global variables unnecessarily in loops. Consider using shift registers to store the data instead.

As far as memory management, use the following tips to improve the overall performance of VIs.

Avoid using local and global variables. Reading local or global variables generates copies of the data in the variable.

Avoid displaying and manipulating large arrays and strings. Indicators on open front panels retain a copy of the data they display.

Use functions that reuse data buffers. Instead of continually increasing the size of an array using Build Array, use a default initialized array and replace the values in that array with the new data. Functions such as Build Array and Concatenate Strings generates copies of data, which increases the number of memory allocations LabVIEW must perform.

Use consistent data types, avoid coercion dots. When LabVIEW changes data types, the output is a new buffer.

When generating arrays inside loops whose representation must change, change the representation inside the loop, not after.

Use For Loops rather than While Loops whenever possible. For Loops enable LabVIEw to determine the amount of memory needed and allocate the necessary space before the first iteration. While Loops do not allow LabVIEW to predetermine the space requirements and demand dynamic allocation.

Let me know if you have any further questions or if this does not resolve your issue.

Thanks again and have a great day!

Chad AE
Applications Engineer - National Instruments
Message 2 of 3
(3,856 Views)

Hello ,

I'm Using Labview 2011 and I built a program that recieve 500 bytes data using modbus Eithernet on a server computer , another computer (client PC) has a user interface program which reads the 500 bytes data using shared variable from server computer  ,,,, but when i run the clien program it work very slowly it take 10 minute to run ,although CPU is 0%-3% ,i run it on several computers but it the same behavior

i attached the vi in client project which i think have the problem

please help me

0 Kudos
Message 3 of 3
(2,867 Views)