Example Code

One Byte XOR LRC Checksum for Communications Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

The code within this example represents communications between two separate VIs.


Description
The data types are converted to strings as this is the type of data transmitted by most LabVIEW data communication functions. The method is useful for serial, UDP and TCP communications. In this example, an input string is converted into a byte array. Each byte is XORed together to produce a new byte which is appended to the byte array. The byte array is converted to a string for transmitting. The string is received and converted to a byte array. All of the bytes are XORed together to produce a new XOR sum. If the communication was successful this new XOR sum will equal 00.If we were successful we can strip off the XOR LRC byte and display the original string.

 
Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  • Input the string to send.
  • Run the program

 

Additional Information or References
VI Snippet

3-336.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Stephen C
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.