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: