Chitika

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.