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.
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
For a LabVIEW example, the following link might help: https://decibel.ni.com/content/docs/DOC-15042