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:
The frequency value entered by user is being multiplied with 100 e.g. in this example 25 has been entered by user so the value transmitted translates to 2500 that we suppose is the requirement of receiver device.However,actual value entered by user is assumed to be 25Mhz.Also 1 is supposed to be the command ID for feeding the frequency value.Here the String terminator character is '@' whose hexa-decimal value is 40 that is appearing in the string displayed on the front panel.

1 comment:

  1. This is very informative posting, it will helpful for us. Thanks for sharing it with us.
    embedded training institute

    ReplyDelete