Chitika

Showing posts with label Labview. Show all posts
Showing posts with label Labview. Show all posts

Thursday, December 10, 2015

Converting Binary Array to Integer Value in Labview

Sometimes its is required to convert binary array into integer value in Labview or sometimes it is required to convert individual binary bits acquired from parallel data lines of output from Analog-to-Digital Converter into integer value that may be used for further processing or mathematical manipulations.Here is a simple Code for implementing this idea in Labview:
Figure 1 : The Front Panel
The Front Panel of this code implementation in Labview is shown in Figure 1.The Front Panel shows to ways of converting to number one from Boolean Array and the other from individual Boolean Bits combined through Build Array function.

Monday, July 13, 2015

Simple Check-sum Calculation in Labview

Sometimes you need to calculate the check-sum of the data sent or received over the serial communication or some other communication link to establish the integrity of the received data.While transmitting data calculated check-sum value,usually a byte is appended at the end of desired data before the terminating byte value,that you can chose at will to mark the end of the transmitted data string or data stream.
There are many ways to calculate check-sum in such cases,but I will discuss simple method of calculating check-sum.Simply add contents of consecutive data bytes,starting from the bytes indicating the start of data string,and ignore the overflown data till all of the bytes have been added to calculate the final check-sum byte.This check-sum byte is appended at the end of desired data before the data string terminating byte.
Here is the simple Labview code,shown below,to calculate the check-sum of a data string that is transmitted over the serial link to the micro-controller which again calculates the check-sum using above mentioned technique.If the check-sum calculated by the micro-controller matches with the relieved check-sum then the data received is supposed to be error free and intact.
The following image shows both the block diagram and front panel of this Labview Code:

Tuesday, July 7, 2015

Conversion of Hexdecimal String to Decimal Values in Labview

It is sometimes required to convert a hexa decimal string, received over serial port or through some other communication link etc., to decimal values either for further processing or for display of data.
The following Labview code converts a string containing hexa decimal data (also displayed in hexa decimal format in the string) to decimal format.
 This is a simple code and contains following key VIs and functions:
  • Hexadecimal String (with Hex display option selected from the front panel )
  • String to Byte Array Conversion Function
  • Index Array Function
  • Join Numbers Function
A screenshot of front panel and block diagram of this Labview program is shown in figure above.It is a simple but quite useful Labview code.

Thursday, March 5, 2015

Labview Program to Plot numerical data written to and Read from a Text File

This is a simple Labview Program to write numerical data,that may come from any sensor or instrument interfaced with PC,to a text file and then read that data to plot that data on a waveform chart.In this code,to simulate the generation of numerical data a random number generator function has been used which writes data to text file and upon reading that written data plots that data on a waveform chart.Labview 2012 has been used for development of this Labview code.There are two tabs on the front panel one writing data to text file and the other one is for reading data from text file.
The screenshots of the Front Panel are shown in Figure 1 & Figure 2 below:
Figure 1