06-10-2015 10:04 AM
Hello,
I received a prtocol for controlling a device with RS232 serial communication.
I need to build two LRC's as check.
I have a working send command and I receive a message back, but I do not understand how to calculatie the LRC.
Can somebody help me with this?
Thanks in advance.
I attached the vi and the protokoll in pdf.
06-22-2015 09:36 AM
Hi RvG,
To calculate the LRC, you perform an XOR operation of every bit, add it to the end of the message, and then XOR that entire message again after transmission. If that second XOR calculation equals zero, then the last bitstream (minus the added LRC value at the end) is the same message as the one that was sent.
This pseudo-code might explain the XOR operation a bit better:
LRC = 0
For every byte (b)
LRC = LRC XOR b
end
For a LabVIEW example, the following link might help: https://decibel.ni.com/content/docs/DOC-15042