LABVIEW – Tip #43 – Close references (memory leak)

Level : Intermediate

To avoid memory leaks from labview code you need to pay attention to references that are created and not yet closed. After create the code is a good practice to create a stress test and look for memory leaks.

Memory leaks increase memory used from our program and somewhere in time crashes the program. Like the critical races, the memory leaks is not easy to detect, you need to test, test, test.

LABVIEW – Tip #41 – Change some Tools Options

level – easy

This is a very personal tip, because I believe everyone need to change the programs preferences to create a more easy and intuitive programing.

Disable in Block Diagram, ‘place front terminal as icons’, to make the code more compact and simple to read.

Disable in Block Diagram, ‘enable automatic wire routing’, to get the power to choose how and where I want the wire to go.

Disable in Front Panel, ‘show front panel grid’, to always view the final result of my UI and be able to change and move all objects pixel by pixel.


Level : Intermediate

Channel Wires can be used to pass information between parallel cycles in a simple way, without having to use queues or notifiers. This type of communication works like the producer / consumer architecture, as we have to be careful in choosing which type of connection to make.
TAG – we can guarantee the execution speed of the reading cycle and can have several modules of writing and reading in the same connection, but the reader can lose data.
STREAM – guarantees the data sequence with a determined buffer size, but the reader can be with a data queue, being delayes compared to the writer.
MESSENGER – guarantees the sequence of the data with a determined buffer size and can have several writing and reading modules on the same connection, but the reader can be with a data queue, being delayed in relation to the writer.

LABVIEW – Tip #36 – Change Data Dialog

Level : Intermediate

Sometimes it is necessary to create a dialog to be able to enter data or even configure something in the program. The dialogue function should be simple so that the user can intuitively know what to do and we can add validations to the ‘inputs’ – so that there are no errors in the program with incorrectly inserted values.

LABVIEW – Quiz #2

In the figure select corresponding leter to:



LABVIEW – Tip #34 – Serial (VISA) – Arduino (button) to LabVIEW

Level : Intermediate

A communication with an external device can be done via USB-Serial-VISA. In this example, the arduino sends the letter ‘A’ by the serial port when the button is pressed and the letter ‘a’ when it is released. Meanwhile labVIEW is waiting for communication through a production cycle, which has the ability to recover if a serial port for disconnected. The consumer cycle makes a change in the control value.

LABVIEW – Quiz #1

Which function node execute first?

Multiply – Possible
Divide – Not
Subtract – Not
Pi – Possible
Add – Possible
Exponential – Not

Any of the functions nodes multiply, pi and add can be the first to be executed, all of them have values in their inputs when the program starts. Because we don’t known which one the compiler decides to be the first to execute, we have to be careful with our code to not create any critical run.

LABVIEW – Tip #23 – Dynamic Threads

Level : Advanced

I like to compare a thread to a wired balloon (where the Wire is the handle) that connects to the program that has created it, so that it can be controlled in a easily way. When creating programs with dynamic threads it gives a huge flexibility, since when we add another connection to the system it is no longer required to change the code and making it more complex.

LABVIEW – Tip #22 – Webserver & IOT

Level : Intermediate

When using a webserver service, it is possible to insert data into the cloud so that they can be available in multiple devices with different operating systems. This type of interconnection may be part of a system based in IOT (internet of things) and can interact with different devices (Get/Insert Data, Input/Outputs).

LABVIEW – Tip #12 – Join Arrays with different dimensions

When joining Arrays with different sizes using Build Array, an Array with bigger dimension will be created and inserting the Default value in the smaller Arrays until they get an equal size. To keep the dimensions of the Arrays you need insert individually on each one as Cluster and with this action they can be inserted into a Build Array without losing their original size.

LABVIEW – Tip #10 – Code sequence

It’s not enough to put the code from left to right in labview, or even up to down to assure it’s sequence. A information flux is always needed to assure that the program behaves as we want, and for that we can use some tools to define the sequence, such as, use the Error Control Line, Flat Sequence, Stacked Sequence, FOR cycle with Structure Case, State Machine…

LABVIEW – Tip #9 – Icon Editor

When we create a ‘vi’ function it is important to change it’s ICON, to make it clear the code implementation. As such when looking to the ICON we should manage to understand it’s function, and for that the should be perceptible (Large letters and abbreviations if needed) as well as a simple drawing can be done that can identify the function, to assist it’s understanding.

LABVIEW – Tip #8 – Shift Register

When it is necessary to pass data between the existent connections of cycles, Shift Register should be used to avoid variables and assure the synchronism. The exit tunnel of Shift Register can be pushed to obtain the values of earlier interactions, from up side down (last one  [-1], penultimate [-2], antepenultimate [-3], …)

LABVIEW – Tip #7 – FOR Cycle

The number of cycles can be initialized with the “N” or by the array entry of the FOR cycle. When it is initialized with “0” on the “N”, the code that is inside the FOR cycle will not executed and the exit tunnels will have their values as default. In case that it is a simple tunnel the default value is the same as the variable type default value, however if it is a shift register the value is the same as the one that is on the entry. So, when initializing with arrays, the quantity of cycles will be defined by the smaller array size. All the other tunnel entries values don’t change the number of cycles in the FOR cycle.

LABVIEW – Tip #6 – User Interface

User Interface can be more important than the code itself, being the ”face” of our program, likewise we need to treat it as such. Treating the UI as a painting, starting first to do a draft where I insert all the necessary elements for the user connection, then proceeding on making the code. During the program execution the information of the objects interacts with the balance of the UI, obtaining the desirable environment.

LABVIEW – Tip #4 – Function Global Variable

To ensure the syncronism when using variables, we can create a highly customized function and use it in any section of the program. For that we can use the while  cycle to make one single interaction (“True” in exit condition) storing one or more shift register to store the information. For the entry conditions of the “case” we can use “enum”, “string”, “numeric”, “bollean”, depending on the requirement.

LABVIEW – Tip #3 – Master / Slave

To use this architecture we can use queues (data sequences) to insert data in the Master and take it out from the queue in one or more Slaves. To finish the Slave execution, it is possible to use the error line of the queue in terminate condition of the while cycle (in release queue it is needed to insert the entry “force destroy” in “True” condition)

LABVIEW – Tip #1 – While cycles

When we use a while cycle in Labview for the program structure and where there is no need for the cycles to be executed quickly, we can use this function to slow it’s execution (eg: wait until)

In this way the program will work as excepted, without making the processor creating the most number of interactions, and with this action it will decrease as well the load of our program and machine.