Labview Data and Memory

In this article, I will briefly go through data storage as memory bits and bytes when programmed using labview code. I particularly like labview when it comes to memory allocation and deallocation. Back in university days, I recall efforts I had to put in C programming language for memory management.

Fortunately, Labview does memory management – allocation and deallocation- for us, Khurram Waris said’.

Such ease means we can focus entirely on creating application and let labview compiler and run time engine takes over and run executable apps. However, it still helps if coder have some understanding of bits/byte taken by labview controls and indicators. A careful choice – single-precision or double-precision- of data representation for real numbers data could save Gigabytes of memory space especially for high speed continuous monitoring data logging application.

big data

Numeric Data:

Numeric real values – non-integer with decimals – could be stored as single, double, extended or complex formats where complex consists of real and imaginary values.

Single Precision:

Single-precision data representation is stored as 32-bit single-precision format. By default, numeric floating points are stored as 64-bit double precision type. If value of data would never exceed 232= 4294967296. Accordingly, typical transducer measurement for instance pressure sensor that measures up to 7500 psi is not required to be displayed or stored as default double precision type.

Double Precision:

Double precision representation is stored as 64-bit IEEE double precision format. Under such representation, number as big as 264= 1.84e19 could be displayed before rolling over to 0.

Double Precision to Single Precision:

Data representation could be easily converted from default double to single precision. To achieve this, right click on control terminal and select single precision type from data representation menu.

Time Stamp data:

Time stamp format and labview function is great to simply display today’s date that would update time in real time. Simply wire ‘Get Time Data in String’ function to time stamp indicator and place in a while loop. Run vi and we have an indicator displaying current time and updating continuously.

From computer science perspective, time stamp is stored as a cluster of four integers where first two signed integers represent time-zone-independent number of complete seconds that have elapsed since 12:00 a.m,. Friday, January 1, 1904. The other two unsigned integers represent the fractions of second.

String data:

String data i.e alphanumeric characters are stored very different to other text based programming languages. Where other languages use null/terminating character to determine the end of the string, labview uses length value. To understand bit more on string storage in labview, labview stores strings as pointers to structure that contains a 4-byte length value followed by a 1D array of byte integers. if pointer to structure is NULL, labview treats string as empty which is same as string with length value zero. It is worth noting that all characters that include NULL character could be embedded into string at any point.

Careful consideration should be taken when passing labview strings to external code that expects a C string as it might require embedding NULL character so code could interpret the string data.

These are amongst the fundamental data types in labview. There are other data types e.g ‘Paths’ which contains path to location on PC directory or network. Clusters, arrays, waveforms, refunds, variants could all be used to easily manage the application data. For more information on labview data storage, see the link below or leave a comment and I will try my best to get back to you as soon as I can.